OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_VIDEO_PROCESSOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_PROCESSOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_PROCESSOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_PROCESSOR_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
12 #include "base/memory/ref_counted.h" | |
13 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
14 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
15 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
16 #include "content/common/gpu/media/v4l2_video_device.h" | 15 #include "content/common/gpu/media/v4l2_video_device.h" |
17 #include "media/base/video_frame.h" | 16 #include "media/base/video_frame.h" |
18 | 17 |
19 namespace content { | 18 namespace content { |
20 | 19 |
21 // Handles image processing accelerators that expose a V4L2 memory-to-memory | 20 // Handles image processing accelerators that expose a V4L2 memory-to-memory |
22 // interface. The threading model of this class is the same as for other V4L2 | 21 // interface. The threading model of this class is the same as for other V4L2 |
23 // hardware accelerators (see V4L2VideoDecodeAccelerator) for more details. | 22 // hardware accelerators (see V4L2VideoDecodeAccelerator) for more details. |
24 class CONTENT_EXPORT V4L2ImageProcessor { | 23 class CONTENT_EXPORT V4L2ImageProcessor { |
25 public: | 24 public: |
26 explicit V4L2ImageProcessor(const scoped_refptr<V4L2Device>& device); | 25 explicit V4L2ImageProcessor(scoped_ptr<V4L2Device> device); |
27 virtual ~V4L2ImageProcessor(); | 26 virtual ~V4L2ImageProcessor(); |
28 | 27 |
29 // Initializes the processor to convert from |input_format| to |output_format| | 28 // Initializes the processor to convert from |input_format| to |output_format| |
30 // and/or scale from |input_visible_size| to |output_visible_size|. | 29 // and/or scale from |input_visible_size| to |output_visible_size|. |
31 // Request the output buffers to be of at least |output_allocated_size|. | 30 // Request the output buffers to be of at least |output_allocated_size|. |
32 // Provided |error_cb| will be called if an error occurs. | 31 // Provided |error_cb| will be called if an error occurs. |
33 // Return true if the requested configuration is supported. | 32 // Return true if the requested configuration is supported. |
34 bool Initialize(media::VideoFrame::Format input_format, | 33 bool Initialize(media::VideoFrame::Format input_format, |
35 media::VideoFrame::Format output_format, | 34 media::VideoFrame::Format output_format, |
36 gfx::Size input_visible_size, | 35 gfx::Size input_visible_size, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 uint32 input_format_fourcc_; | 129 uint32 input_format_fourcc_; |
131 uint32 output_format_fourcc_; | 130 uint32 output_format_fourcc_; |
132 | 131 |
133 size_t input_planes_count_; | 132 size_t input_planes_count_; |
134 size_t output_planes_count_; | 133 size_t output_planes_count_; |
135 | 134 |
136 // Our original calling message loop for the child thread. | 135 // Our original calling message loop for the child thread. |
137 const scoped_refptr<base::MessageLoopProxy> child_message_loop_proxy_; | 136 const scoped_refptr<base::MessageLoopProxy> child_message_loop_proxy_; |
138 | 137 |
139 // V4L2 device in use. | 138 // V4L2 device in use. |
140 scoped_refptr<V4L2Device> device_; | 139 scoped_ptr<V4L2Device> device_; |
141 | 140 |
142 // Thread to communicate with the device on. | 141 // Thread to communicate with the device on. |
143 base::Thread device_thread_; | 142 base::Thread device_thread_; |
144 // Thread used to poll the V4L2 for events only. | 143 // Thread used to poll the V4L2 for events only. |
145 base::Thread device_poll_thread_; | 144 base::Thread device_poll_thread_; |
146 | 145 |
147 // All the below members are to be accessed from device_thread_ only | 146 // All the below members are to be accessed from device_thread_ only |
148 // (if it's running). | 147 // (if it's running). |
149 std::queue<linked_ptr<JobRecord> > input_queue_; | 148 std::queue<linked_ptr<JobRecord> > input_queue_; |
150 std::queue<linked_ptr<JobRecord> > running_jobs_; | 149 std::queue<linked_ptr<JobRecord> > running_jobs_; |
(...skipping 21 matching lines...) Expand all Loading... |
172 | 171 |
173 // Weak factory for producing weak pointers on the device_thread_ | 172 // Weak factory for producing weak pointers on the device_thread_ |
174 base::WeakPtrFactory<V4L2ImageProcessor> device_weak_factory_; | 173 base::WeakPtrFactory<V4L2ImageProcessor> device_weak_factory_; |
175 | 174 |
176 DISALLOW_COPY_AND_ASSIGN(V4L2ImageProcessor); | 175 DISALLOW_COPY_AND_ASSIGN(V4L2ImageProcessor); |
177 }; | 176 }; |
178 | 177 |
179 } // namespace content | 178 } // namespace content |
180 | 179 |
181 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_PROCESSOR_H_ | 180 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_PROCESSOR_H_ |
OLD | NEW |