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

Side by Side Diff: media/video/capture/mac/video_capture_device_qtkit_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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h" 5 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h"
6 6
7 #import <QTKit/QTKit.h> 7 #import <QTKit/QTKit.h>
8 8
9 #include "base/debug/crash_logging.h" 9 #include "base/debug/crash_logging.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 11 matching lines...) Expand all
22 // Third-party drivers often throw exceptions, which are fatal in 22 // Third-party drivers often throw exceptions, which are fatal in
23 // Chromium (see comments in scoped_nsexception_enabler.h). The 23 // Chromium (see comments in scoped_nsexception_enabler.h). The
24 // following catches any exceptions and continues in an orderly 24 // following catches any exceptions and continues in an orderly
25 // fashion with no devices detected. 25 // fashion with no devices detected.
26 NSArray* captureDevices = 26 NSArray* captureDevices =
27 base::mac::RunBlockIgnoringExceptions(^{ 27 base::mac::RunBlockIgnoringExceptions(^{
28 return [QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo]; 28 return [QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo];
29 }); 29 });
30 30
31 for (QTCaptureDevice* device in captureDevices) { 31 for (QTCaptureDevice* device in captureDevices) {
32 if (![[device attributeForKey:QTCaptureDeviceSuspendedAttribute] boolValue]) 32 if ([[device attributeForKey:QTCaptureDeviceSuspendedAttribute] boolValue])
33 [deviceNames setObject:[device localizedDisplayName] 33 continue;
34 forKey:[device uniqueID]]; 34 DeviceNameAndTransportType* nameAndTransportType =
35 [[[DeviceNameAndTransportType alloc]
36 initWithName:[device localizedDisplayName]
37 transportType:media::kIOAudioDeviceTransportTypeUnknown]
38 autorelease];
39 [deviceNames setObject:nameAndTransportType
40 forKey:[device uniqueID]];
35 } 41 }
36 } 42 }
37 43
38 + (NSDictionary*)deviceNames { 44 + (NSDictionary*)deviceNames {
39 NSMutableDictionary* deviceNames = 45 NSMutableDictionary* deviceNames =
40 [[[NSMutableDictionary alloc] init] autorelease]; 46 [[[NSMutableDictionary alloc] init] autorelease];
41 47
42 // TODO(shess): Post to the main thread to see if that helps 48 // TODO(shess): Post to the main thread to see if that helps
43 // http://crbug.com/139164 49 // http://crbug.com/139164
44 [self performSelectorOnMainThread:@selector(getDeviceNames:) 50 [self performSelectorOnMainThread:@selector(getDeviceNames:)
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 337
332 - (void)sendErrorString:(NSString*)error { 338 - (void)sendErrorString:(NSString*)error {
333 DLOG(ERROR) << [error UTF8String]; 339 DLOG(ERROR) << [error UTF8String];
334 [lock_ lock]; 340 [lock_ lock];
335 if (frameReceiver_) 341 if (frameReceiver_)
336 frameReceiver_->ReceiveError([error UTF8String]); 342 frameReceiver_->ReceiveError([error UTF8String]);
337 [lock_ unlock]; 343 [lock_ unlock];
338 } 344 }
339 345
340 @end 346 @end
OLDNEW
« no previous file with comments | « media/video/capture/mac/video_capture_device_mac.mm ('k') | media/video/capture/video_capture_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698