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

Side by Side Diff: media/video/capture/mac/video_capture_device_avfoundation_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: 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_avfoundation_mac.h" 5 #import "media/video/capture/mac/video_capture_device_avfoundation_mac.h"
6 6
7 #import <CoreVideo/CoreVideo.h> 7 #import <CoreVideo/CoreVideo.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
11 #include "media/video/capture/mac/video_capture_device_mac.h" 11 #include "media/video/capture/mac/video_capture_device_mac.h"
12 #include "ui/gfx/size.h" 12 #include "ui/gfx/size.h"
13 13
14 @implementation VideoCaptureDeviceAVFoundation 14 @implementation VideoCaptureDeviceAVFoundation
15 15
16 #pragma mark Class methods 16 #pragma mark Class methods
17 17
18 + (void)getDeviceNames:(NSMutableDictionary*)deviceNames { 18 + (void)getDeviceNames:(NSMutableDictionary*)deviceNames {
19 // At this stage we already know that AVFoundation is supported and the whole 19 // At this stage we already know that AVFoundation is supported and the whole
20 // library is loaded and initialised, by the device monitoring. 20 // library is loaded and initialised, by the device monitoring.
21 NSArray* devices = [AVCaptureDeviceGlue devices]; 21 NSArray* devices = [AVCaptureDeviceGlue devices];
22 for (CrAVCaptureDevice* device in devices) { 22 for (CrAVCaptureDevice* device in devices) {
23 if (([device hasMediaType:AVFoundationGlue::AVMediaTypeVideo()] || 23 if (([device hasMediaType:AVFoundationGlue::AVMediaTypeVideo()] ||
24 [device hasMediaType:AVFoundationGlue::AVMediaTypeMuxed()]) && 24 [device hasMediaType:AVFoundationGlue::AVMediaTypeMuxed()]) &&
25 ![device isSuspended]) { 25 ![device isSuspended]) {
26 [deviceNames setObject:[device localizedName] 26 [deviceNames setObject:[[DeviceNameAndTransportType alloc]
Robert Sesek 2014/07/01 14:16:07 This is leaked. I'd also pull this out into a loca
mcasas 2014/07/01 16:06:10 Done.
27 initWithName:[device localizedName]
28 transportType:[device transportType]]
27 forKey:[device uniqueID]]; 29 forKey:[device uniqueID]];
28 } 30 }
29 } 31 }
30 } 32 }
31 33
32 + (NSDictionary*)deviceNames { 34 + (NSDictionary*)deviceNames {
33 NSMutableDictionary* deviceNames = 35 NSMutableDictionary* deviceNames =
34 [[[NSMutableDictionary alloc] init] autorelease]; 36 [[[NSMutableDictionary alloc] init] autorelease];
35 // The device name retrieval is not going to happen in the main thread, and 37 // The device name retrieval is not going to happen in the main thread, and
36 // this might cause instabilities (it did in QTKit), so keep an eye here. 38 // this might cause instabilities (it did in QTKit), so keep an eye here.
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 286 }
285 287
286 - (void)sendErrorString:(NSString*)error { 288 - (void)sendErrorString:(NSString*)error {
287 DLOG(ERROR) << [error UTF8String]; 289 DLOG(ERROR) << [error UTF8String];
288 base::AutoLock lock(lock_); 290 base::AutoLock lock(lock_);
289 if (frameReceiver_) 291 if (frameReceiver_)
290 frameReceiver_->ReceiveError([error UTF8String]); 292 frameReceiver_->ReceiveError([error UTF8String]);
291 } 293 }
292 294
293 @end 295 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698