| 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 = | 38 is_device_blacklisted = base::EndsWith(name.id(), |
| 39 base::EndsWith(name.id(), | 39 kBlacklistedCameras[i].unique_id_signature, false); |
| 40 kBlacklistedCameras[i].unique_id_signature, | |
| 41 base::CompareCase::INSENSITIVE_ASCII); | |
| 42 } | 40 } |
| 43 DVLOG_IF(2, is_device_blacklisted) << "Blacklisted camera: " << | 41 DVLOG_IF(2, is_device_blacklisted) << "Blacklisted camera: " << |
| 44 name.name() << ", id: " << name.id(); | 42 name.name() << ", id: " << name.id(); |
| 45 return is_device_blacklisted; | 43 return is_device_blacklisted; |
| 46 } | 44 } |
| 47 | 45 |
| 48 static scoped_ptr<media::VideoCaptureDevice::Names> | 46 static scoped_ptr<media::VideoCaptureDevice::Names> |
| 49 EnumerateDevicesUsingQTKit() { | 47 EnumerateDevicesUsingQTKit() { |
| 50 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/458397 is | 48 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/458397 is |
| 51 // fixed. | 49 // fixed. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 [VideoCaptureDeviceAVFoundation getDevice:device | 177 [VideoCaptureDeviceAVFoundation getDevice:device |
| 180 supportedFormats:supported_formats]; | 178 supportedFormats:supported_formats]; |
| 181 break; | 179 break; |
| 182 case VideoCaptureDevice::Name::QTKIT: | 180 case VideoCaptureDevice::Name::QTKIT: |
| 183 // Blacklisted cameras provide their own supported format(s), otherwise no | 181 // Blacklisted cameras provide their own supported format(s), otherwise no |
| 184 // such information is provided for QTKit devices. | 182 // such information is provided for QTKit devices. |
| 185 if (device.is_blacklisted()) { | 183 if (device.is_blacklisted()) { |
| 186 for (size_t i = 0; i < arraysize(kBlacklistedCameras); ++i) { | 184 for (size_t i = 0; i < arraysize(kBlacklistedCameras); ++i) { |
| 187 if (base::EndsWith(device.id(), | 185 if (base::EndsWith(device.id(), |
| 188 kBlacklistedCameras[i].unique_id_signature, | 186 kBlacklistedCameras[i].unique_id_signature, |
| 189 base::CompareCase::INSENSITIVE_ASCII)) { | 187 false)) { |
| 190 supported_formats->push_back(media::VideoCaptureFormat( | 188 supported_formats->push_back(media::VideoCaptureFormat( |
| 191 gfx::Size(kBlacklistedCameras[i].capture_width, | 189 gfx::Size(kBlacklistedCameras[i].capture_width, |
| 192 kBlacklistedCameras[i].capture_height), | 190 kBlacklistedCameras[i].capture_height), |
| 193 kBlacklistedCameras[i].capture_frame_rate, | 191 kBlacklistedCameras[i].capture_frame_rate, |
| 194 media::VIDEO_CAPTURE_PIXEL_FORMAT_UYVY)); | 192 media::VIDEO_CAPTURE_PIXEL_FORMAT_UYVY)); |
| 195 break; | 193 break; |
| 196 } | 194 } |
| 197 } | 195 } |
| 198 } | 196 } |
| 199 break; | 197 break; |
| 200 case VideoCaptureDevice::Name::DECKLINK: | 198 case VideoCaptureDevice::Name::DECKLINK: |
| 201 DVLOG(1) << "Enumerating video capture capabilities " << device.name(); | 199 DVLOG(1) << "Enumerating video capture capabilities " << device.name(); |
| 202 VideoCaptureDeviceDeckLinkMac::EnumerateDeviceCapabilities( | 200 VideoCaptureDeviceDeckLinkMac::EnumerateDeviceCapabilities( |
| 203 device, supported_formats); | 201 device, supported_formats); |
| 204 break; | 202 break; |
| 205 default: | 203 default: |
| 206 NOTREACHED(); | 204 NOTREACHED(); |
| 207 } | 205 } |
| 208 } | 206 } |
| 209 | 207 |
| 210 // static | 208 // static |
| 211 VideoCaptureDeviceFactory* | 209 VideoCaptureDeviceFactory* |
| 212 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( | 210 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( |
| 213 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 211 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
| 214 return new VideoCaptureDeviceFactoryMac(ui_task_runner); | 212 return new VideoCaptureDeviceFactoryMac(ui_task_runner); |
| 215 } | 213 } |
| 216 | 214 |
| 217 } // namespace media | 215 } // namespace media |
| OLD | NEW |