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 <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" | |
21 #include "content/common/gpu/media/shared_memory_region.h" | |
22 #include "content/common/gpu/media/v4l2_device.h" | |
23 #include "media/base/bitstream_buffer.h" | 20 #include "media/base/bitstream_buffer.h" |
24 #include "media/base/video_frame.h" | 21 #include "media/base/video_frame.h" |
| 22 #include "media/gpu/media_gpu_export.h" |
| 23 #include "media/gpu/shared_memory_region.h" |
| 24 #include "media/gpu/v4l2_device.h" |
25 #include "media/video/jpeg_decode_accelerator.h" | 25 #include "media/video/jpeg_decode_accelerator.h" |
26 | 26 |
27 namespace content { | 27 namespace media { |
28 | 28 |
29 class CONTENT_EXPORT V4L2JpegDecodeAccelerator | 29 class MEDIA_GPU_EXPORT V4L2JpegDecodeAccelerator |
30 : public media::JpegDecodeAccelerator { | 30 : public media::JpegDecodeAccelerator { |
31 public: | 31 public: |
32 V4L2JpegDecodeAccelerator( | 32 V4L2JpegDecodeAccelerator( |
33 const scoped_refptr<V4L2Device>& device, | 33 const scoped_refptr<V4L2Device>& device, |
34 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | 34 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
35 ~V4L2JpegDecodeAccelerator() override; | 35 ~V4L2JpegDecodeAccelerator() override; |
36 | 36 |
37 // media::JpegDecodeAccelerator implementation. | 37 // media::JpegDecodeAccelerator implementation. |
38 bool Initialize(Client* client) override; | 38 bool Initialize(Client* client) override; |
39 void Decode(const media::BitstreamBuffer& bitstream_buffer, | 39 void Decode(const media::BitstreamBuffer& bitstream_buffer, |
40 const scoped_refptr<media::VideoFrame>& video_frame) override; | 40 const scoped_refptr<media::VideoFrame>& video_frame) override; |
41 bool IsSupported() override; | 41 bool IsSupported() override; |
42 | 42 |
43 private: | 43 private: |
44 // Record for input/output buffers. | 44 // Record for input/output buffers. |
45 struct BufferRecord { | 45 struct BufferRecord { |
46 BufferRecord(); | 46 BufferRecord(); |
47 ~BufferRecord(); | 47 ~BufferRecord(); |
48 void* address; // mmap() address. | 48 void* address; // mmap() address. |
49 size_t length; // mmap() length. | 49 size_t length; // mmap() length. |
50 | 50 |
51 // Set true during QBUF and DQBUF. |address| will be accessed by hardware. | 51 // Set true during QBUF and DQBUF. |address| will be accessed by hardware. |
52 bool at_device; | 52 bool at_device; |
53 }; | 53 }; |
54 | 54 |
55 // 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 |
56 // BufferRecord of input, because a BufferRecord of input may be returned | 56 // BufferRecord of input, because a BufferRecord of input may be returned |
57 // 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 |
58 // associated with a BufferRecord of output immediately either, because at | 58 // associated with a BufferRecord of output immediately either, because at |
59 // 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 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 // Weak factory for producing weak pointers on the child thread. | 171 // Weak factory for producing weak pointers on the child thread. |
172 base::WeakPtrFactory<V4L2JpegDecodeAccelerator> weak_factory_; | 172 base::WeakPtrFactory<V4L2JpegDecodeAccelerator> weak_factory_; |
173 // 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 |
174 // the ChildThread. | 174 // the ChildThread. |
175 base::WeakPtr<V4L2JpegDecodeAccelerator> weak_ptr_; | 175 base::WeakPtr<V4L2JpegDecodeAccelerator> weak_ptr_; |
176 | 176 |
177 DISALLOW_COPY_AND_ASSIGN(V4L2JpegDecodeAccelerator); | 177 DISALLOW_COPY_AND_ASSIGN(V4L2JpegDecodeAccelerator); |
178 }; | 178 }; |
179 | 179 |
180 } // namespace content | 180 } // namespace media |
181 | 181 |
182 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_ | 182 #endif // MEDIA_GPU_V4L2_JPEG_DECODE_ACCELERATOR_H_ |
OLD | NEW |