Chromium Code Reviews| Index: media/gpu/v4l2_jpeg_decode_accelerator.h |
| diff --git a/media/gpu/v4l2_jpeg_decode_accelerator.h b/media/gpu/v4l2_jpeg_decode_accelerator.h |
| index b2824946b9a812bc15c0bc6d8d67071692024417..65b3d6b8ee90faadd2a6f2106c00779b60494c38 100644 |
| --- a/media/gpu/v4l2_jpeg_decode_accelerator.h |
| +++ b/media/gpu/v4l2_jpeg_decode_accelerator.h |
| @@ -42,12 +42,18 @@ class MEDIA_GPU_EXPORT V4L2JpegDecodeAccelerator |
| bool IsSupported() override; |
| private: |
| + // Input pixel format is alwasy V4L2_PIX_FMT_JPEG. |
| + static const uint32_t kInputPlanes = 1; |
| + // Ouput buffer has three physical planes. |
|
wuchengli
2016/12/16 03:15:15
I found the number of planes can be 1 V4L2_PIX_FMT
|
| + static const uint32_t kOutputPlanes = 3; |
| + |
| // Record for input/output buffers. |
| struct BufferRecord { |
| BufferRecord(); |
| ~BufferRecord(); |
| - void* address; // mmap() address. |
| - size_t length; // mmap() length. |
| + void* address[kOutputPlanes]; // mmap() address. |
| + size_t length[kOutputPlanes]; // mmap() length. |
| + size_t num_planes; // Number of mapped planes. |
|
wuchengli
2016/12/16 03:15:15
s/planes/physical planes/. So it's clear this is n
|
| // Set true during QBUF and DQBUF. |address| will be accessed by hardware. |
| bool at_device; |
| @@ -82,6 +88,16 @@ class MEDIA_GPU_EXPORT V4L2JpegDecodeAccelerator |
| void DestroyInputBuffers(); |
| void DestroyOutputBuffers(); |
| + // Convert |src_buffer| to I420 and copy the result to |dst_frame|. |
| + // The function currently accepts the following format as |src_pixelformat|: |
| + // - All splane formats that libyuv::ConvertToI420 can handle. |
| + // - V4L2_YUV_420M |
| + // - V4L2_YUV_422MV |
| + bool ConvertOutputImage(const uint32_t src_pixelformat, |
| + const BufferRecord& src_buffer, |
| + const gfx::Size& src_coded_size, |
| + const scoped_refptr<VideoFrame>& dst_frame); |
| + |
| // Return the number of input/output buffers enqueued to the device. |
| size_t InputBufferQueuedCount(); |
| size_t OutputBufferQueuedCount(); |
| @@ -153,6 +169,8 @@ class MEDIA_GPU_EXPORT V4L2JpegDecodeAccelerator |
| std::queue<linked_ptr<JobRecord>> input_jobs_; |
| std::queue<linked_ptr<JobRecord>> running_jobs_; |
| + // V4L2 buffer type of the input buffer. |
| + v4l2_buf_type input_buf_type_; |
| // Input queue state. |
| bool input_streamon_; |
| // Mapping of int index to an input buffer record. |
| @@ -161,6 +179,8 @@ class MEDIA_GPU_EXPORT V4L2JpegDecodeAccelerator |
| // ordering. |
| std::vector<int> free_input_buffers_; |
| + // V4L2 buffer type of the output buffer. |
| + v4l2_buf_type output_buf_type_; |
| // Output queue state. |
| bool output_streamon_; |
| // Mapping of int index to an output buffer record. |