Chromium Code Reviews| 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..6f2437db1a1bd4fc52c94381ef8d5d6a4ed2431e 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) ? |
|
Robert Sesek
2014/07/01 16:23:57
nit: indent this line 4 more spaces, since the con
mcasas
2014/07/02 07:37: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) { |