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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 AVFOUNDATION, | 62 AVFOUNDATION, |
63 QTKIT, | 63 QTKIT, |
64 DECKLINK, | 64 DECKLINK, |
65 API_TYPE_UNKNOWN | 65 API_TYPE_UNKNOWN |
66 }; | 66 }; |
67 // For AVFoundation Api, identify devices that are built-in or USB. | 67 // For AVFoundation Api, identify devices that are built-in or USB. |
68 enum TransportType { | 68 enum TransportType { |
69 USB_OR_BUILT_IN, | 69 USB_OR_BUILT_IN, |
70 OTHER_TRANSPORT | 70 OTHER_TRANSPORT |
71 }; | 71 }; |
| 72 #elif defined (OS_ANDROID) |
| 73 // Android targets Capture Api type: it can only be set on construction. |
| 74 // Automatically generated enum to interface with Java world. |
| 75 // |
| 76 // A Java counterpart will be generated for this enum. |
| 77 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.media |
| 78 enum CaptureApiType { |
| 79 API1, |
| 80 API2_LEGACY, |
| 81 API2_FULL, |
| 82 API2_LIMITED, |
| 83 TANGO, |
| 84 API_TYPE_UNKNOWN |
| 85 }; |
72 #endif | 86 #endif |
73 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) | 87 |
74 Name(const std::string& name, | 88 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ |
75 const std::string& id, | 89 defined(OS_ANDROID) |
| 90 Name(const std::string& name, const std::string& id, |
76 const CaptureApiType api_type); | 91 const CaptureApiType api_type); |
77 #endif | 92 #endif |
78 #if defined(OS_MACOSX) | 93 #if defined(OS_MACOSX) |
79 Name(const std::string& name, | 94 Name(const std::string& name, |
80 const std::string& id, | 95 const std::string& id, |
81 const CaptureApiType api_type, | 96 const CaptureApiType api_type, |
82 const TransportType transport_type); | 97 const TransportType transport_type); |
83 #endif | 98 #endif |
84 ~Name(); | 99 ~Name(); |
85 | 100 |
(...skipping 15 matching lines...) Expand all Loading... |
101 // These operators are needed due to storing the name in an STL container. | 116 // These operators are needed due to storing the name in an STL container. |
102 // In the shared build, all methods from the STL container will be exported | 117 // In the shared build, all methods from the STL container will be exported |
103 // so even though they're not used, they're still depended upon. | 118 // so even though they're not used, they're still depended upon. |
104 bool operator==(const Name& other) const { | 119 bool operator==(const Name& other) const { |
105 return other.id() == unique_id_; | 120 return other.id() == unique_id_; |
106 } | 121 } |
107 bool operator<(const Name& other) const { | 122 bool operator<(const Name& other) const { |
108 return unique_id_ < other.id(); | 123 return unique_id_ < other.id(); |
109 } | 124 } |
110 | 125 |
111 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) | 126 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ |
| 127 defined(OS_ANDROID) |
112 CaptureApiType capture_api_type() const { | 128 CaptureApiType capture_api_type() const { |
113 return capture_api_class_.capture_api_type(); | 129 return capture_api_class_.capture_api_type(); |
114 } | 130 } |
115 const char* GetCaptureApiTypeString() const; | 131 const char* GetCaptureApiTypeString() const; |
116 #endif | 132 #endif |
117 #if defined(OS_WIN) | 133 #if defined(OS_WIN) |
118 // Certain devices need an ID different from the |unique_id_| for | 134 // Certain devices need an ID different from the |unique_id_| for |
119 // capabilities retrieval. | 135 // capabilities retrieval. |
120 const std::string& capabilities_id() const { | 136 const std::string& capabilities_id() const { |
121 return capabilities_id_; | 137 return capabilities_id_; |
122 } | 138 } |
123 void set_capabilities_id(const std::string& id) { | 139 void set_capabilities_id(const std::string& id) { |
124 capabilities_id_ = id; | 140 capabilities_id_ = id; |
125 } | 141 } |
126 #endif | 142 #endif // if defined(OS_WIN) |
127 #if defined(OS_MACOSX) | 143 #if defined(OS_MACOSX) |
128 TransportType transport_type() const { | 144 TransportType transport_type() const { |
129 return transport_type_; | 145 return transport_type_; |
130 } | 146 } |
131 bool is_blacklisted() const { | 147 bool is_blacklisted() const { |
132 return is_blacklisted_; | 148 return is_blacklisted_; |
133 } | 149 } |
134 void set_is_blacklisted(bool is_blacklisted) { | 150 void set_is_blacklisted(bool is_blacklisted) { |
135 is_blacklisted_ = is_blacklisted; | 151 is_blacklisted_ = is_blacklisted; |
136 } | 152 } |
137 #endif // if defined(OS_WIN) | 153 #endif // if defined(OS_MACOSX) |
138 | 154 |
139 private: | 155 private: |
140 std::string device_name_; | 156 std::string device_name_; |
141 std::string unique_id_; | 157 std::string unique_id_; |
142 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) | 158 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ |
| 159 defined(OS_ANDROID) |
143 // This class wraps the CaptureApiType to give it a by default value if not | 160 // This class wraps the CaptureApiType to give it a by default value if not |
144 // initialized. | 161 // initialized. |
145 class CaptureApiClass { | 162 class CaptureApiClass { |
146 public: | 163 public: |
147 CaptureApiClass(): capture_api_type_(API_TYPE_UNKNOWN) {} | 164 CaptureApiClass(): capture_api_type_(API_TYPE_UNKNOWN) {} |
148 CaptureApiClass(const CaptureApiType api_type) | 165 CaptureApiClass(const CaptureApiType api_type) |
149 : capture_api_type_(api_type) {} | 166 : capture_api_type_(api_type) {} |
150 CaptureApiType capture_api_type() const { | 167 CaptureApiType capture_api_type() const { |
151 DCHECK_NE(capture_api_type_, API_TYPE_UNKNOWN); | 168 DCHECK_NE(capture_api_type_, API_TYPE_UNKNOWN); |
152 return capture_api_type_; | 169 return capture_api_type_; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 int GetPowerLineFrequencyForLocation() const; | 292 int GetPowerLineFrequencyForLocation() const; |
276 | 293 |
277 protected: | 294 protected: |
278 static const int kPowerLine50Hz = 50; | 295 static const int kPowerLine50Hz = 50; |
279 static const int kPowerLine60Hz = 60; | 296 static const int kPowerLine60Hz = 60; |
280 }; | 297 }; |
281 | 298 |
282 } // namespace media | 299 } // namespace media |
283 | 300 |
284 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 301 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |