Index: media/video/capture/mac/video_capture_device_factory_mac.mm |
diff --git a/media/video/capture/mac/video_capture_device_factory_mac.mm b/media/video/capture/mac/video_capture_device_factory_mac.mm |
index d58a25c658687e18ee8261874b4a8076b50f4c1e..96ae3af5504d5a19e673f0ba1801f040bf554232 100644 |
--- a/media/video/capture/mac/video_capture_device_factory_mac.mm |
+++ b/media/video/capture/mac/video_capture_device_factory_mac.mm |
@@ -4,6 +4,8 @@ |
#include "media/video/capture/mac/video_capture_device_factory_mac.h" |
+#import <IOKit/audio/IOAudioTypes.h> |
+ |
#include "base/bind.h" |
#include "base/location.h" |
#include "base/task_runner_util.h" |
@@ -34,7 +36,7 @@ EnumerateDevicesUsingQTKit() { |
[VideoCaptureDeviceQTKit getDeviceNames:capture_devices]; |
for (NSString* key in capture_devices) { |
VideoCaptureDevice::Name name( |
- [[capture_devices valueForKey:key] UTF8String], |
+ [[[capture_devices valueForKey:key] deviceName] UTF8String], |
[key UTF8String], VideoCaptureDevice::Name::QTKIT); |
device_names->push_back(name); |
} |
@@ -106,9 +108,17 @@ void VideoCaptureDeviceFactoryMac::GetDeviceNames( |
// Enumerate all devices found by AVFoundation, translate the info for each |
// to class Name and add it to |device_names|. |
for (NSString* key in capture_devices) { |
+ int transport_type = [[capture_devices valueForKey:key] transportType]; |
+ // Transport types are defined for Audio devices and reused for video. |
+ VideoCaptureDevice::Name::TransportType device_transport_type = |
+ (transport_type == kIOAudioDeviceTransportTypeBuiltIn || |
+ transport_type == kIOAudioDeviceTransportTypeUSB) ? |
tommi (sloooow) - chröme
2014/07/03 10:28:36
nit: align the conditions
mcasas
2014/07/03 16:18:35
Done.
|
+ VideoCaptureDevice::Name::USB_OR_BUILT_IN : |
+ VideoCaptureDevice::Name::OTHER_TRANSPORT; |
VideoCaptureDevice::Name name( |
- [[capture_devices valueForKey:key] UTF8String], |
- [key UTF8String], VideoCaptureDevice::Name::AVFOUNDATION); |
+ [[[capture_devices valueForKey:key] deviceName] UTF8String], |
+ [key UTF8String], VideoCaptureDevice::Name::AVFOUNDATION, |
+ device_transport_type); |
device_names->push_back(name); |
// Extract the device's Vendor ID and compare to all blacklisted ones. |
device_vid = name.GetModel().substr(0, kVidPidSize); |
@@ -126,7 +136,7 @@ void VideoCaptureDeviceFactoryMac::GetDeviceNames( |
if (is_any_device_blacklisted) { |
capture_devices = [VideoCaptureDeviceQTKit deviceNames]; |
for (NSString* key in capture_devices) { |
- NSString* device_name = [capture_devices valueForKey:key]; |
+ NSString* device_name = [[capture_devices valueForKey:key] deviceName]; |
for (size_t i = 0; i < arraysize(kBlacklistedCameras); ++i) { |
if ([device_name rangeOfString:@(kBlacklistedCameras[i].name) |
options:NSCaseInsensitiveSearch].length != 0) { |