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

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

Issue 24615005: Added AVFoundation Glue and Device Monitoring for Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/avfoundation_glue.mm
diff --git a/media/video/capture/mac/avfoundation_glue.mm b/media/video/capture/mac/avfoundation_glue.mm
new file mode 100644
index 0000000000000000000000000000000000000000..25207942d09178e8b8e91f28a8e616597a348309
--- /dev/null
+++ b/media/video/capture/mac/avfoundation_glue.mm
@@ -0,0 +1,41 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "media/video/capture/mac/avfoundation_glue.h"
+
+#include "base/mac/mac_util.h"
+
+@implementation AVFoundationGlue
+
++ (BOOL)IsAVFoundationSupported {
+ return (base::mac::IsOSLionOrLater() &&
+ [[AVFoundationGlue getAVFoundationBundle] load]);
+}
+
++ (NSBundle*)getAVFoundationBundle {
+ 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.
+ bundleWithPath:@"/System/Library/Frameworks/AVFoundation.framework"];
+}
+
+@end // @implementation AVFoundationGlue
+
+
+@implementation AVCaptureDeviceGlue
+
++ (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.
+ Class avcClass = [[AVFoundationGlue getAVFoundationBundle]
+ classNamed:@"AVCaptureDevice"];
+ return [avcClass devices];
+}
+
+- (BOOL)hasMediaType:(NSString *)mediaType {
+ 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.
+ 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
+ // 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
+ // bundle's classes access: first find it, then alloc-init.
+ 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
+ return [AVCaptureDeviceInstance hasMediaType:mediaType];
+}
+
+@end // @implementation AVCaptureDevice
« media/video/capture/mac/avfoundation_glue.h ('K') | « media/video/capture/mac/avfoundation_glue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698