Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import "media/video/capture/mac/avfoundation_glue.h" | |
| 6 | |
| 7 #include "base/mac/mac_util.h" | |
| 8 | |
| 9 @implementation AVFoundationGlue | |
| 10 | |
| 11 + (BOOL)IsAVFoundationSupported { | |
| 12 return (base::mac::IsOSLionOrLater() && | |
| 13 [[AVFoundationGlue getAVFoundationBundle] load]); | |
| 14 } | |
| 15 | |
| 16 + (NSBundle*)getAVFoundationBundle { | |
| 17 return [NSBundle | |
|
Mark Mentovai
2013/09/26 17:09:10
This gets a new bundle each time it’s called, whic
mcasas
2013/09/30 17:53:50
Done.
| |
| 18 bundleWithPath:@"/System/Library/Frameworks/AVFoundation.framework"]; | |
| 19 } | |
| 20 | |
| 21 @end // @implementation AVFoundationGlue | |
| 22 | |
| 23 | |
| 24 @implementation AVCaptureDeviceGlue | |
| 25 | |
| 26 + (NSArray *)devices { | |
|
Mark Mentovai
2013/09/26 17:09:10
Same comment about consistency with spacing around
mcasas
2013/09/30 17:53:50
Done.
| |
| 27 Class avcClass = [[AVFoundationGlue getAVFoundationBundle] | |
| 28 classNamed:@"AVCaptureDevice"]; | |
| 29 return [avcClass devices]; | |
| 30 } | |
| 31 | |
| 32 - (BOOL)hasMediaType:(NSString *)mediaType { | |
| 33 Class AVCaptureDeviceClass = [[AVFoundationGlue getAVFoundationBundle] | |
|
Mark Mentovai
2013/09/26 17:09:10
AVCaptureDeviceClass is a local variable, and thos
mcasas
2013/09/30 17:53:50
Done.
| |
| 34 classNamed:@"AVCAptureDevice"]; | |
|
Mark Mentovai
2013/09/26 17:09:10
This class name is miscapitalized. Did you even te
mcasas
2013/09/30 17:53:50
I did but clearly this error did not show up :(, I
| |
| 35 // See http://goo.gl/hYvBs3 for an explanation of the 2 step process for | |
|
Mark Mentovai
2013/09/26 17:09:10
Apple doc links go stale frequently. Don’t use sho
mcasas
2013/09/30 17:53:50
Might be obvious for you ;) but for me, having to
| |
| 36 // bundle's classes access: first find it, then alloc-init. | |
| 37 id AVCaptureDeviceInstance =[[AVCaptureDeviceClass alloc] init]; | |
|
Mark Mentovai
2013/09/26 17:09:10
Space on each side of operators, like =.
Mark Mentovai
2013/09/26 17:09:10
You alloc and init this, don’t release it or autor
Mark Mentovai
2013/09/26 17:09:10
It seems very suspicious that you would just alloc
mcasas
2013/09/30 17:53:50
Yes absolutely. My bad. The real way is to compose
| |
| 38 return [AVCaptureDeviceInstance hasMediaType:mediaType]; | |
| 39 } | |
| 40 | |
| 41 @end // @implementation AVCaptureDevice | |
| OLD | NEW |