| 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 MEDIA_GPU_V4L2_JPEG_DECODE_ACCELERATOR_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_ | 6 #define MEDIA_GPU_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 <memory> | 11 #include <memory> |
| 12 #include <queue> | 12 #include <queue> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
| 20 #include "base/threading/thread.h" | 20 #include "base/threading/thread.h" |
| 21 #include "content/common/content_export.h" | |
| 22 #include "content/common/gpu/media/shared_memory_region.h" | |
| 23 #include "content/common/gpu/media/v4l2_device.h" | |
| 24 #include "media/base/bitstream_buffer.h" | 21 #include "media/base/bitstream_buffer.h" |
| 25 #include "media/base/video_frame.h" | 22 #include "media/base/video_frame.h" |
| 23 #include "media/gpu/media_gpu_export.h" |
| 24 #include "media/gpu/shared_memory_region.h" |
| 25 #include "media/gpu/v4l2_device.h" |
| 26 #include "media/video/jpeg_decode_accelerator.h" | 26 #include "media/video/jpeg_decode_accelerator.h" |
| 27 | 27 |
| 28 namespace content { | 28 namespace media { |
| 29 | 29 |
| 30 class CONTENT_EXPORT V4L2JpegDecodeAccelerator | 30 class MEDIA_GPU_EXPORT V4L2JpegDecodeAccelerator |
| 31 : public media::JpegDecodeAccelerator { | 31 : public media::JpegDecodeAccelerator { |
| 32 public: | 32 public: |
| 33 V4L2JpegDecodeAccelerator( | 33 V4L2JpegDecodeAccelerator( |
| 34 const scoped_refptr<V4L2Device>& device, | 34 const scoped_refptr<V4L2Device>& device, |
| 35 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | 35 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
| 36 ~V4L2JpegDecodeAccelerator() override; | 36 ~V4L2JpegDecodeAccelerator() override; |
| 37 | 37 |
| 38 // media::JpegDecodeAccelerator implementation. | 38 // media::JpegDecodeAccelerator implementation. |
| 39 bool Initialize(Client* client) override; | 39 bool Initialize(Client* client) override; |
| 40 void Decode(const media::BitstreamBuffer& bitstream_buffer, | 40 void Decode(const media::BitstreamBuffer& bitstream_buffer, |
| 41 const scoped_refptr<media::VideoFrame>& video_frame) override; | 41 const scoped_refptr<media::VideoFrame>& video_frame) override; |
| 42 bool IsSupported() override; | 42 bool IsSupported() override; |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 // Record for input/output buffers. | 45 // Record for input/output buffers. |
| 46 struct BufferRecord { | 46 struct BufferRecord { |
| 47 BufferRecord(); | 47 BufferRecord(); |
| 48 ~BufferRecord(); | 48 ~BufferRecord(); |
| 49 void* address; // mmap() address. | 49 void* address; // mmap() address. |
| 50 size_t length; // mmap() length. | 50 size_t length; // mmap() length. |
| 51 | 51 |
| 52 // Set true during QBUF and DQBUF. |address| will be accessed by hardware. | 52 // Set true during QBUF and DQBUF. |address| will be accessed by hardware. |
| 53 bool at_device; | 53 bool at_device; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 // Job record. Jobs are processed in a FIFO order. This is separate from | 56 // Job record. Jobs are processed in a FIFO order. This is separate from |
| 57 // BufferRecord of input, because a BufferRecord of input may be returned | 57 // BufferRecord of input, because a BufferRecord of input may be returned |
| 58 // before we dequeue the corresponding output buffer. It can't always be | 58 // before we dequeue the corresponding output buffer. It can't always be |
| 59 // associated with a BufferRecord of output immediately either, because at | 59 // associated with a BufferRecord of output immediately either, because at |
| 60 // the time of submission we may not have one available (and don't need one | 60 // the time of submission we may not have one available (and don't need one |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 // Weak factory for producing weak pointers on the child thread. | 172 // Weak factory for producing weak pointers on the child thread. |
| 173 base::WeakPtrFactory<V4L2JpegDecodeAccelerator> weak_factory_; | 173 base::WeakPtrFactory<V4L2JpegDecodeAccelerator> weak_factory_; |
| 174 // Point to |this| for use in posting tasks from the decoder thread back to | 174 // Point to |this| for use in posting tasks from the decoder thread back to |
| 175 // the ChildThread. | 175 // the ChildThread. |
| 176 base::WeakPtr<V4L2JpegDecodeAccelerator> weak_ptr_; | 176 base::WeakPtr<V4L2JpegDecodeAccelerator> weak_ptr_; |
| 177 | 177 |
| 178 DISALLOW_COPY_AND_ASSIGN(V4L2JpegDecodeAccelerator); | 178 DISALLOW_COPY_AND_ASSIGN(V4L2JpegDecodeAccelerator); |
| 179 }; | 179 }; |
| 180 | 180 |
| 181 } // namespace content | 181 } // namespace media |
| 182 | 182 |
| 183 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_ | 183 #endif // MEDIA_GPU_V4L2_JPEG_DECODE_ACCELERATOR_H_ |
| OLD | NEW |