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 #include "media/video/capture/mac/video_capture_device_factory_mac.h" | 5 #include "media/video/capture/mac/video_capture_device_factory_mac.h" |
6 | 6 |
7 #import <IOKit/audio/IOAudioTypes.h> | 7 #import <IOKit/audio/IOAudioTypes.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 const char* unique_id_signature; | 28 const char* unique_id_signature; |
29 const int capture_width; | 29 const int capture_width; |
30 const int capture_height; | 30 const int capture_height; |
31 const float capture_frame_rate; | 31 const float capture_frame_rate; |
32 } kBlacklistedCameras[] = { {"-01FDA82C8A9C", 1280, 720, 60.0f } }; | 32 } kBlacklistedCameras[] = { {"-01FDA82C8A9C", 1280, 720, 60.0f } }; |
33 | 33 |
34 static bool IsDeviceBlacklisted(const VideoCaptureDevice::Name& name) { | 34 static bool IsDeviceBlacklisted(const VideoCaptureDevice::Name& name) { |
35 bool is_device_blacklisted = false; | 35 bool is_device_blacklisted = false; |
36 for(size_t i = 0; | 36 for(size_t i = 0; |
37 !is_device_blacklisted && i < arraysize(kBlacklistedCameras); ++i) { | 37 !is_device_blacklisted && i < arraysize(kBlacklistedCameras); ++i) { |
38 is_device_blacklisted = EndsWith(name.id(), | 38 is_device_blacklisted = base::EndsWith(name.id(), |
39 kBlacklistedCameras[i].unique_id_signature, false); | 39 kBlacklistedCameras[i].unique_id_signature, false); |
40 } | 40 } |
41 DVLOG_IF(2, is_device_blacklisted) << "Blacklisted camera: " << | 41 DVLOG_IF(2, is_device_blacklisted) << "Blacklisted camera: " << |
42 name.name() << ", id: " << name.id(); | 42 name.name() << ", id: " << name.id(); |
43 return is_device_blacklisted; | 43 return is_device_blacklisted; |
44 } | 44 } |
45 | 45 |
46 static scoped_ptr<media::VideoCaptureDevice::Names> | 46 static scoped_ptr<media::VideoCaptureDevice::Names> |
47 EnumerateDevicesUsingQTKit() { | 47 EnumerateDevicesUsingQTKit() { |
48 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/458397 is | 48 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/458397 is |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 case VideoCaptureDevice::Name::AVFOUNDATION: | 175 case VideoCaptureDevice::Name::AVFOUNDATION: |
176 DVLOG(1) << "Enumerating video capture capabilities, AVFoundation"; | 176 DVLOG(1) << "Enumerating video capture capabilities, AVFoundation"; |
177 [VideoCaptureDeviceAVFoundation getDevice:device | 177 [VideoCaptureDeviceAVFoundation getDevice:device |
178 supportedFormats:supported_formats]; | 178 supportedFormats:supported_formats]; |
179 break; | 179 break; |
180 case VideoCaptureDevice::Name::QTKIT: | 180 case VideoCaptureDevice::Name::QTKIT: |
181 // Blacklisted cameras provide their own supported format(s), otherwise no | 181 // Blacklisted cameras provide their own supported format(s), otherwise no |
182 // such information is provided for QTKit devices. | 182 // such information is provided for QTKit devices. |
183 if (device.is_blacklisted()) { | 183 if (device.is_blacklisted()) { |
184 for (size_t i = 0; i < arraysize(kBlacklistedCameras); ++i) { | 184 for (size_t i = 0; i < arraysize(kBlacklistedCameras); ++i) { |
185 if (EndsWith(device.id(), kBlacklistedCameras[i].unique_id_signature, | 185 if (base::EndsWith(device.id(), |
| 186 kBlacklistedCameras[i].unique_id_signature, |
186 false)) { | 187 false)) { |
187 supported_formats->push_back(media::VideoCaptureFormat( | 188 supported_formats->push_back(media::VideoCaptureFormat( |
188 gfx::Size(kBlacklistedCameras[i].capture_width, | 189 gfx::Size(kBlacklistedCameras[i].capture_width, |
189 kBlacklistedCameras[i].capture_height), | 190 kBlacklistedCameras[i].capture_height), |
190 kBlacklistedCameras[i].capture_frame_rate, | 191 kBlacklistedCameras[i].capture_frame_rate, |
191 media::PIXEL_FORMAT_UYVY)); | 192 media::PIXEL_FORMAT_UYVY)); |
192 break; | 193 break; |
193 } | 194 } |
194 } | 195 } |
195 } | 196 } |
196 break; | 197 break; |
197 case VideoCaptureDevice::Name::DECKLINK: | 198 case VideoCaptureDevice::Name::DECKLINK: |
198 DVLOG(1) << "Enumerating video capture capabilities " << device.name(); | 199 DVLOG(1) << "Enumerating video capture capabilities " << device.name(); |
199 VideoCaptureDeviceDeckLinkMac::EnumerateDeviceCapabilities( | 200 VideoCaptureDeviceDeckLinkMac::EnumerateDeviceCapabilities( |
200 device, supported_formats); | 201 device, supported_formats); |
201 break; | 202 break; |
202 default: | 203 default: |
203 NOTREACHED(); | 204 NOTREACHED(); |
204 } | 205 } |
205 } | 206 } |
206 | 207 |
207 // static | 208 // static |
208 VideoCaptureDeviceFactory* | 209 VideoCaptureDeviceFactory* |
209 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( | 210 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( |
210 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 211 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
211 return new VideoCaptureDeviceFactoryMac(ui_task_runner); | 212 return new VideoCaptureDeviceFactoryMac(ui_task_runner); |
212 } | 213 } |
213 | 214 |
214 } // namespace media | 215 } // namespace media |
OLD | NEW |