| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <queue> | 11 #include <queue> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 19 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
| 20 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
| 21 #include "content/common/gpu/media/shared_memory_region.h" |
| 21 #include "content/common/gpu/media/v4l2_device.h" | 22 #include "content/common/gpu/media/v4l2_device.h" |
| 22 #include "media/base/bitstream_buffer.h" | 23 #include "media/base/bitstream_buffer.h" |
| 23 #include "media/base/video_frame.h" | 24 #include "media/base/video_frame.h" |
| 24 #include "media/video/jpeg_decode_accelerator.h" | 25 #include "media/video/jpeg_decode_accelerator.h" |
| 25 | 26 |
| 26 namespace content { | 27 namespace content { |
| 27 | 28 |
| 28 class CONTENT_EXPORT V4L2JpegDecodeAccelerator | 29 class CONTENT_EXPORT V4L2JpegDecodeAccelerator |
| 29 : public media::JpegDecodeAccelerator { | 30 : public media::JpegDecodeAccelerator { |
| 30 public: | 31 public: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 51 bool at_device; | 52 bool at_device; |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 // Job record. Jobs are processed in a FIFO order. This is separate from | 55 // Job record. Jobs are processed in a FIFO order. This is separate from |
| 55 // BufferRecord of input, because a BufferRecord of input may be returned | 56 // BufferRecord of input, because a BufferRecord of input may be returned |
| 56 // before we dequeue the corresponding output buffer. It can't always be | 57 // before we dequeue the corresponding output buffer. It can't always be |
| 57 // associated with a BufferRecord of output immediately either, because at | 58 // associated with a BufferRecord of output immediately either, because at |
| 58 // the time of submission we may not have one available (and don't need one | 59 // the time of submission we may not have one available (and don't need one |
| 59 // to submit input to the device). | 60 // to submit input to the device). |
| 60 struct JobRecord { | 61 struct JobRecord { |
| 61 JobRecord(media::BitstreamBuffer bitstream_buffer, | 62 JobRecord(const media::BitstreamBuffer& bitstream_buffer, |
| 62 scoped_refptr<media::VideoFrame> video_frame); | 63 scoped_refptr<media::VideoFrame> video_frame); |
| 63 ~JobRecord(); | 64 ~JobRecord(); |
| 64 | 65 |
| 65 // Input image buffer. | 66 // Input image buffer ID. |
| 66 media::BitstreamBuffer bitstream_buffer; | 67 int32_t bitstream_buffer_id; |
| 68 // Memory mapped from |bitstream_buffer|. |
| 69 SharedMemoryRegion shm; |
| 67 // Output frame buffer. | 70 // Output frame buffer. |
| 68 scoped_refptr<media::VideoFrame> out_frame; | 71 scoped_refptr<media::VideoFrame> out_frame; |
| 69 // Memory mapped from |bitstream_buffer|. | |
| 70 scoped_ptr<base::SharedMemory> shm; | |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 void EnqueueInput(); | 74 void EnqueueInput(); |
| 74 void EnqueueOutput(); | 75 void EnqueueOutput(); |
| 75 void Dequeue(); | 76 void Dequeue(); |
| 76 bool EnqueueInputRecord(); | 77 bool EnqueueInputRecord(); |
| 77 bool EnqueueOutputRecord(); | 78 bool EnqueueOutputRecord(); |
| 78 bool CreateInputBuffers(); | 79 bool CreateInputBuffers(); |
| 79 bool CreateOutputBuffers(); | 80 bool CreateOutputBuffers(); |
| 80 void DestroyInputBuffers(); | 81 void DestroyInputBuffers(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // Point to |this| for use in posting tasks from the decoder thread back to | 173 // Point to |this| for use in posting tasks from the decoder thread back to |
| 173 // the ChildThread. | 174 // the ChildThread. |
| 174 base::WeakPtr<V4L2JpegDecodeAccelerator> weak_ptr_; | 175 base::WeakPtr<V4L2JpegDecodeAccelerator> weak_ptr_; |
| 175 | 176 |
| 176 DISALLOW_COPY_AND_ASSIGN(V4L2JpegDecodeAccelerator); | 177 DISALLOW_COPY_AND_ASSIGN(V4L2JpegDecodeAccelerator); |
| 177 }; | 178 }; |
| 178 | 179 |
| 179 } // namespace content | 180 } // namespace content |
| 180 | 181 |
| 181 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_ | 182 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_ |
| OLD | NEW |