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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 API_TYPE_UNKNOWN | 58 API_TYPE_UNKNOWN |
59 }; | 59 }; |
60 #elif defined(OS_WIN) | 60 #elif defined(OS_WIN) |
61 // 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. |
62 enum CaptureApiType { MEDIA_FOUNDATION, DIRECT_SHOW, API_TYPE_UNKNOWN }; | 62 enum CaptureApiType { MEDIA_FOUNDATION, DIRECT_SHOW, API_TYPE_UNKNOWN }; |
63 #elif defined(OS_MACOSX) | 63 #elif defined(OS_MACOSX) |
64 // 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. |
65 enum CaptureApiType { AVFOUNDATION, QTKIT, DECKLINK, API_TYPE_UNKNOWN }; | 65 enum CaptureApiType { AVFOUNDATION, DECKLINK, API_TYPE_UNKNOWN }; |
66 // For AVFoundation Api, identify devices that are built-in or USB. | 66 // For AVFoundation Api, identify devices that are built-in or USB. |
67 enum TransportType { USB_OR_BUILT_IN, OTHER_TRANSPORT }; | 67 enum TransportType { USB_OR_BUILT_IN, OTHER_TRANSPORT }; |
68 #elif defined(OS_ANDROID) | 68 #elif defined(OS_ANDROID) |
69 // Android targets Capture Api type: it can only be set on construction. | 69 // Android targets Capture Api type: it can only be set on construction. |
70 // Automatically generated enum to interface with Java world. | 70 // Automatically generated enum to interface with Java world. |
71 // | 71 // |
72 // A Java counterpart will be generated for this enum. | 72 // A Java counterpart will be generated for this enum. |
73 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.media | 73 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.media |
74 enum CaptureApiType { | 74 enum CaptureApiType { |
75 API1, | 75 API1, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 const char* GetCaptureApiTypeString() const; | 126 const char* GetCaptureApiTypeString() const; |
127 #endif | 127 #endif |
128 #if defined(OS_WIN) | 128 #if defined(OS_WIN) |
129 // Certain devices need an ID different from the |unique_id_| for | 129 // Certain devices need an ID different from the |unique_id_| for |
130 // capabilities retrieval. | 130 // capabilities retrieval. |
131 const std::string& capabilities_id() const { return capabilities_id_; } | 131 const std::string& capabilities_id() const { return capabilities_id_; } |
132 void set_capabilities_id(const std::string& id) { capabilities_id_ = id; } | 132 void set_capabilities_id(const std::string& id) { capabilities_id_ = id; } |
133 #endif // if defined(OS_WIN) | 133 #endif // if defined(OS_WIN) |
134 #if defined(OS_MACOSX) | 134 #if defined(OS_MACOSX) |
135 TransportType transport_type() const { return transport_type_; } | 135 TransportType transport_type() const { return transport_type_; } |
136 bool is_blacklisted() const { return is_blacklisted_; } | |
137 void set_is_blacklisted(bool is_blacklisted) { | |
138 is_blacklisted_ = is_blacklisted; | |
139 } | |
140 #endif // if defined(OS_MACOSX) | 136 #endif // if defined(OS_MACOSX) |
141 | 137 |
142 private: | 138 private: |
143 std::string device_name_; | 139 std::string device_name_; |
144 std::string unique_id_; | 140 std::string unique_id_; |
145 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ | 141 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ |
146 defined(OS_ANDROID) | 142 defined(OS_ANDROID) |
147 // This class wraps the CaptureApiType to give it a by default value if not | 143 // This class wraps the CaptureApiType to give it a by default value if not |
148 // initialized. | 144 // initialized. |
149 class CaptureApiClass { | 145 class CaptureApiClass { |
(...skipping 11 matching lines...) Expand all Loading... |
161 }; | 157 }; |
162 | 158 |
163 CaptureApiClass capture_api_class_; | 159 CaptureApiClass capture_api_class_; |
164 #endif | 160 #endif |
165 #if defined(OS_WIN) | 161 #if defined(OS_WIN) |
166 // ID used for capabilities retrieval. By default is equal to |unique_id|. | 162 // ID used for capabilities retrieval. By default is equal to |unique_id|. |
167 std::string capabilities_id_; | 163 std::string capabilities_id_; |
168 #endif | 164 #endif |
169 #if defined(OS_MACOSX) | 165 #if defined(OS_MACOSX) |
170 TransportType transport_type_; | 166 TransportType transport_type_; |
171 // Flag used to mark blacklisted devices for QTKit Api. | |
172 bool is_blacklisted_; | |
173 #endif | 167 #endif |
174 // Allow generated copy constructor and assignment. | 168 // Allow generated copy constructor and assignment. |
175 }; | 169 }; |
176 | 170 |
177 // Manages a list of Name entries. | 171 // Manages a list of Name entries. |
178 typedef std::list<Name> Names; | 172 typedef std::list<Name> Names; |
179 | 173 |
180 // Interface defining the methods that clients of VideoCapture must have. It | 174 // Interface defining the methods that clients of VideoCapture must have. It |
181 // is actually two-in-one: clients may implement OnIncomingCapturedData() or | 175 // is actually two-in-one: clients may implement OnIncomingCapturedData() or |
182 // ReserveOutputBuffer() + OnIncomingCapturedVideoFrame(), or all of them. | 176 // ReserveOutputBuffer() + OnIncomingCapturedVideoFrame(), or all of them. |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 305 |
312 private: | 306 private: |
313 // Gets the power line frequency from the current system time zone if this is | 307 // Gets the power line frequency from the current system time zone if this is |
314 // defined, otherwise returns 0. | 308 // defined, otherwise returns 0. |
315 PowerLineFrequency GetPowerLineFrequencyForLocation() const; | 309 PowerLineFrequency GetPowerLineFrequencyForLocation() const; |
316 }; | 310 }; |
317 | 311 |
318 } // namespace media | 312 } // namespace media |
319 | 313 |
320 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 314 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |