OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // VideoCaptureDevice is the abstract base class for realizing video capture | 5 // VideoCaptureDevice is the abstract base class for realizing video capture |
6 // device support in Chromium. It provides the interface for OS dependent | 6 // device support in Chromium. It provides the interface for OS dependent |
7 // implementations. | 7 // implementations. |
8 // The class is created and functions are invoked on a thread owned by | 8 // The class is created and functions are invoked on a thread owned by |
9 // VideoCaptureManager. Capturing is done on other threads, depending on the OS | 9 // VideoCaptureManager. Capturing is done on other threads, depending on the OS |
10 // specific implementation. | 10 // specific implementation. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // VideoCaptureDevice::Create. | 48 // VideoCaptureDevice::Create. |
49 class MEDIA_EXPORT Name { | 49 class MEDIA_EXPORT Name { |
50 public: | 50 public: |
51 Name(); | 51 Name(); |
52 Name(const std::string& name, const std::string& id); | 52 Name(const std::string& name, const std::string& id); |
53 | 53 |
54 #if defined(OS_LINUX) | 54 #if defined(OS_LINUX) |
55 // Linux/CrOS targets Capture Api type: it can only be set on construction. | 55 // Linux/CrOS targets Capture Api type: it can only be set on construction. |
56 enum CaptureApiType { | 56 enum CaptureApiType { |
57 V4L2_SINGLE_PLANE, | 57 V4L2_SINGLE_PLANE, |
58 V4L2_MULTI_PLANE, | |
59 API_TYPE_UNKNOWN | 58 API_TYPE_UNKNOWN |
60 }; | 59 }; |
61 #elif defined(OS_WIN) | 60 #elif defined(OS_WIN) |
62 // Windows targets Capture Api type: it can only be set on construction. | 61 // Windows targets Capture Api type: it can only be set on construction. |
63 enum CaptureApiType { MEDIA_FOUNDATION, DIRECT_SHOW, API_TYPE_UNKNOWN }; | 62 enum CaptureApiType { MEDIA_FOUNDATION, DIRECT_SHOW, API_TYPE_UNKNOWN }; |
64 #elif defined(OS_MACOSX) | 63 #elif defined(OS_MACOSX) |
65 // Mac targets Capture Api type: it can only be set on construction. | 64 // Mac targets Capture Api type: it can only be set on construction. |
66 enum CaptureApiType { AVFOUNDATION, QTKIT, DECKLINK, API_TYPE_UNKNOWN }; | 65 enum CaptureApiType { AVFOUNDATION, QTKIT, DECKLINK, API_TYPE_UNKNOWN }; |
67 // For AVFoundation Api, identify devices that are built-in or USB. | 66 // For AVFoundation Api, identify devices that are built-in or USB. |
68 enum TransportType { USB_OR_BUILT_IN, OTHER_TRANSPORT }; | 67 enum TransportType { USB_OR_BUILT_IN, OTHER_TRANSPORT }; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 // The format of the frame is described by |frame_format|, and is assumed to | 205 // The format of the frame is described by |frame_format|, and is assumed to |
207 // be tightly packed. This method will try to reserve an output buffer and | 206 // be tightly packed. This method will try to reserve an output buffer and |
208 // copy from |data| into the output buffer. If no output buffer is | 207 // copy from |data| into the output buffer. If no output buffer is |
209 // available, the frame will be silently dropped. | 208 // available, the frame will be silently dropped. |
210 virtual void OnIncomingCapturedData(const uint8_t* data, | 209 virtual void OnIncomingCapturedData(const uint8_t* data, |
211 int length, | 210 int length, |
212 const VideoCaptureFormat& frame_format, | 211 const VideoCaptureFormat& frame_format, |
213 int clockwise_rotation, | 212 int clockwise_rotation, |
214 const base::TimeTicks& timestamp) = 0; | 213 const base::TimeTicks& timestamp) = 0; |
215 | 214 |
216 // Captured a 3 planar YUV frame. Planes are possibly disjoint. | |
217 // |frame_format| must indicate I420. | |
218 virtual void OnIncomingCapturedYuvData( | |
219 const uint8_t* y_data, | |
220 const uint8_t* u_data, | |
221 const uint8_t* v_data, | |
222 size_t y_stride, | |
223 size_t u_stride, | |
224 size_t v_stride, | |
225 const VideoCaptureFormat& frame_format, | |
226 int clockwise_rotation, | |
227 const base::TimeTicks& timestamp) = 0; | |
228 | |
229 // Reserve an output buffer into which contents can be captured directly. | 215 // Reserve an output buffer into which contents can be captured directly. |
230 // The returned Buffer will always be allocated with a memory size suitable | 216 // The returned Buffer will always be allocated with a memory size suitable |
231 // for holding a packed video frame with pixels of |format| format, of | 217 // for holding a packed video frame with pixels of |format| format, of |
232 // |dimensions| frame dimensions. It is permissible for |dimensions| to be | 218 // |dimensions| frame dimensions. It is permissible for |dimensions| to be |
233 // zero; in which case the returned Buffer does not guarantee memory | 219 // zero; in which case the returned Buffer does not guarantee memory |
234 // backing, but functions as a reservation for external input for the | 220 // backing, but functions as a reservation for external input for the |
235 // purposes of buffer throttling. | 221 // purposes of buffer throttling. |
236 // | 222 // |
237 // The output buffer stays reserved and mapped for use until the Buffer | 223 // The output buffer stays reserved and mapped for use until the Buffer |
238 // object is destroyed or returned. | 224 // object is destroyed or returned. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 283 |
298 private: | 284 private: |
299 // Gets the power line frequency from the current system time zone if this is | 285 // Gets the power line frequency from the current system time zone if this is |
300 // defined, otherwise returns 0. | 286 // defined, otherwise returns 0. |
301 PowerLineFrequency GetPowerLineFrequencyForLocation() const; | 287 PowerLineFrequency GetPowerLineFrequencyForLocation() const; |
302 }; | 288 }; |
303 | 289 |
304 } // namespace media | 290 } // namespace media |
305 | 291 |
306 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 292 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |