Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: media/video/capture/mac/video_capture_device_factory_mac.mm

Issue 366593003: Mac VideoCapture: return empty GetModel() for non-USB non-built-in cameras. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: FakeVCD and FileVCD specify AVFoundation API type. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 7eb8fe908df50f47e742baddb961d320ec6026bb..f0ce904a0bc61ac8b8b20b3863d4fb10d8d9a76c 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/strings/string_util.h"
@@ -32,7 +34,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);
}
@@ -103,9 +105,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)
+ ? 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);
for (size_t i = 0; i < arraysize(kBlacklistedCameras); ++i) {
is_any_device_blacklisted = EndsWith(name.id(),
@@ -121,7 +131,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) {
« no previous file with comments | « media/video/capture/mac/video_capture_device_avfoundation_mac.mm ('k') | media/video/capture/mac/video_capture_device_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698