Index: media/gpu/v4l2_device.h |
diff --git a/media/gpu/v4l2_device.h b/media/gpu/v4l2_device.h |
index edf4686543080995a1ccdeb442f210010b165afc..83f56bf073d5be85551e04c7d2205844a1a6452e 100644 |
--- a/media/gpu/v4l2_device.h |
+++ b/media/gpu/v4l2_device.h |
@@ -20,6 +20,7 @@ |
#include "media/base/video_frame.h" |
#include "media/gpu/media_gpu_export.h" |
#include "media/video/video_decode_accelerator.h" |
+#include "media/video/video_encode_accelerator.h" |
#include "ui/gfx/geometry/size.h" |
#include "ui/gl/gl_bindings.h" |
@@ -39,22 +40,28 @@ class MEDIA_GPU_EXPORT V4L2Device |
static uint32_t VideoPixelFormatToV4L2PixFmt(VideoPixelFormat format); |
static uint32_t VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, |
bool slice_based); |
+ std::vector<VideoCodecProfile> V4L2PixFmtToVideoCodecProfiles( |
+ uint32_t pix_fmt, |
+ bool is_encoder); |
static uint32_t V4L2PixFmtToDrmFormat(uint32_t format); |
// Convert format requirements requested by a V4L2 device to gfx::Size. |
static gfx::Size CodedSizeFromV4L2Format(struct v4l2_format format); |
- enum Type { |
+ enum class Type { |
kDecoder, |
kEncoder, |
kImageProcessor, |
kJpegDecoder, |
}; |
- // Creates and initializes an appropriate V4L2Device of |type| for the |
- // current platform and returns a scoped_refptr<V4L2Device> on success, or |
- // NULL. |
+ // Creates and initializes a V4L2Device class instance to operate on devices |
+ // of |type|, returning nullptr on failure. |
static scoped_refptr<V4L2Device> Create(Type type); |
+ // Opens an appropriate V4L2 device node of type this class has been created |
+ // for, and to be used with |v4l2_pixfmt|. Returns true on success. |
+ virtual bool Open(uint32_t v4l2_pixfmt) = 0; |
+ |
// Parameters and return value are the same as for the standard ioctl() system |
// call. |
virtual int Ioctl(int request, void* arg) = 0; |
@@ -85,10 +92,6 @@ class MEDIA_GPU_EXPORT V4L2Device |
unsigned int offset) = 0; |
virtual void Munmap(void* addr, unsigned int len) = 0; |
- // Initializes the V4L2Device to operate as a device of |type|. |
- // Returns true on success. |
- virtual bool Initialize() = 0; |
- |
// Return a vector of dmabuf file descriptors, exported for V4L2 buffer with |
// |index|, assuming the buffer contains |num_planes| V4L2 planes and is of |
// |type|. Return an empty vector on failure. |
@@ -134,23 +137,39 @@ class MEDIA_GPU_EXPORT V4L2Device |
gfx::Size* min_resolution, |
gfx::Size* max_resolution); |
+ // Return V4L2 pixelformats supported by the available image processor |
+ // devices for |buf_type|. |
+ virtual std::vector<uint32_t> GetSupportedImageProcessorPixelformats( |
kcwu
2016/10/06 10:40:00
These new added apis all have side-effects.
1. Th
Pawel Osciak
2016/10/07 08:30:24
Yes, I also wasn't happy about 1, it should be han
|
+ v4l2_buf_type buf_type) = 0; |
+ |
// Return supported profiles for decoder, including only profiles for given |
// fourcc |pixelformats|. |
- VideoDecodeAccelerator::SupportedProfiles GetSupportedDecodeProfiles( |
+ virtual VideoDecodeAccelerator::SupportedProfiles GetSupportedDecodeProfiles( |
const size_t num_formats, |
- const uint32_t pixelformats[]); |
+ const uint32_t pixelformats[]) = 0; |
+ |
+ // Return supported profiles for encoder. |
+ virtual VideoEncodeAccelerator::SupportedProfiles |
+ GetSupportedEncodeProfiles() = 0; |
- // Return true if the device supports |profile|, taking into account only |
- // fourccs from the given array of |pixelformats| of size |num_formats|. |
- bool SupportsDecodeProfileForV4L2PixelFormats(VideoCodecProfile profile, |
- const size_t num_formats, |
- const uint32_t pixelformats[]); |
+ // Return true if JPEG decoding is supported, false otherwise. |
+ virtual bool IsJpegDecodingSupported() = 0; |
protected: |
friend class base::RefCountedThreadSafe<V4L2Device>; |
explicit V4L2Device(Type type); |
virtual ~V4L2Device(); |
+ virtual bool Initialize() = 0; |
+ |
+ VideoDecodeAccelerator::SupportedProfiles EnumerateSupportedDecodeProfiles( |
+ const size_t num_formats, |
+ const uint32_t pixelformats[]); |
+ |
+ VideoEncodeAccelerator::SupportedProfiles EnumerateSupportedEncodeProfiles(); |
+ |
+ std::vector<uint32_t> EnumerateSupportedPixelformats(v4l2_buf_type buf_type); |
+ |
const Type type_; |
}; |