| OLD | NEW |
| 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/base/mac/avfoundation_glue.h" | 5 #import "media/base/mac/avfoundation_glue.h" |
| 6 | 6 |
| 7 #import <AVFoundation/AVFoundation.h> | 7 #import <AVFoundation/AVFoundation.h> |
| 8 #include <dlfcn.h> | 8 #include <dlfcn.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/mac/mac_util.h" | 13 #include "base/mac/mac_util.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 17 #include "media/base/media_switches.h" | 17 #include "media/base/media_switches.h" |
| 18 | 18 |
| 19 // Forward declarations of AVFoundation.h strings. | |
| 20 // This is needed to avoid compile time warnings since currently | |
| 21 // |mac_deployment_target| is 10.6. | |
| 22 extern NSString* const AVCaptureDeviceWasConnectedNotification; | |
| 23 extern NSString* const AVCaptureDeviceWasDisconnectedNotification; | |
| 24 extern NSString* const AVMediaTypeVideo; | |
| 25 extern NSString* const AVMediaTypeAudio; | |
| 26 extern NSString* const AVMediaTypeMuxed; | |
| 27 extern NSString* const AVCaptureSessionRuntimeErrorNotification; | |
| 28 extern NSString* const AVCaptureSessionDidStopRunningNotification; | |
| 29 extern NSString* const AVCaptureSessionErrorKey; | |
| 30 extern NSString* const AVVideoScalingModeKey; | |
| 31 extern NSString* const AVVideoScalingModeResizeAspectFill; | |
| 32 | |
| 33 namespace { | 19 namespace { |
| 34 // This class is used to retrieve AVFoundation NSBundle and library handle. It | 20 // This class is used to retrieve AVFoundation NSBundle and library handle. It |
| 35 // must be used as a LazyInstance so that it is initialised once and in a | 21 // must be used as a LazyInstance so that it is initialised once and in a |
| 36 // thread-safe way. Normally no work is done in constructors: LazyInstance is | 22 // thread-safe way. Normally no work is done in constructors: LazyInstance is |
| 37 // an exception. | 23 // an exception. |
| 38 class AVFoundationInternal { | 24 class AVFoundationInternal { |
| 39 public: | 25 public: |
| 40 AVFoundationInternal() { | 26 AVFoundationInternal() { |
| 41 bundle_ = [NSBundle | 27 bundle_ = [NSBundle |
| 42 bundleWithPath:@"/System/Library/Frameworks/AVFoundation.framework"]; | 28 bundleWithPath:@"/System/Library/Frameworks/AVFoundation.framework"]; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 @implementation AVCaptureDeviceInputGlue | 191 @implementation AVCaptureDeviceInputGlue |
| 206 | 192 |
| 207 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device | 193 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device |
| 208 error:(NSError**)outError { | 194 error:(NSError**)outError { |
| 209 return [[AVFoundationGlue::AVFoundationBundle() | 195 return [[AVFoundationGlue::AVFoundationBundle() |
| 210 classNamed:@"AVCaptureDeviceInput"] deviceInputWithDevice:device | 196 classNamed:@"AVCaptureDeviceInput"] deviceInputWithDevice:device |
| 211 error:outError]; | 197 error:outError]; |
| 212 } | 198 } |
| 213 | 199 |
| 214 @end // @implementation AVCaptureDeviceInputGlue | 200 @end // @implementation AVCaptureDeviceInputGlue |
| OLD | NEW |