| 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 // AVFoundation API is only introduced in Mac OS X > 10.6, and there is only one | 5 // TODO(mcasas): Remove this whole glue, https://crbug.com/579648. This glue was |
| 6 // build of Chromium, so the (potential) linking with AVFoundation has to happen | 6 // introduced to support Mac OS X <= 10.6 where AVFoundation was not available, |
| 7 // in runtime. For this to be clean, an AVFoundationGlue class is defined to try | 7 // and had to happen in runtime. |
| 8 // and load these AVFoundation system libraries. If it succeeds, subsequent | |
| 9 // clients can use AVFoundation via the rest of the classes declared in this | |
| 10 // file. | |
| 11 | 8 |
| 12 #ifndef MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ | 9 #ifndef MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ |
| 13 #define MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ | 10 #define MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ |
| 14 | 11 |
| 15 #if defined(__OBJC__) | 12 #if defined(__OBJC__) |
| 16 #import <Foundation/Foundation.h> | 13 #import <Foundation/Foundation.h> |
| 17 #endif // defined(__OBJC__) | 14 #endif // defined(__OBJC__) |
| 18 | 15 |
| 19 #include <stdint.h> | 16 #include <stdint.h> |
| 20 | 17 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 44 static NSString* AVCaptureSessionRuntimeErrorNotification(); | 41 static NSString* AVCaptureSessionRuntimeErrorNotification(); |
| 45 static NSString* AVCaptureSessionDidStopRunningNotification(); | 42 static NSString* AVCaptureSessionDidStopRunningNotification(); |
| 46 static NSString* AVCaptureSessionErrorKey(); | 43 static NSString* AVCaptureSessionErrorKey(); |
| 47 | 44 |
| 48 // Originally from AVVideoSettings.h but in global namespace. | 45 // Originally from AVVideoSettings.h but in global namespace. |
| 49 static NSString* AVVideoScalingModeKey(); | 46 static NSString* AVVideoScalingModeKey(); |
| 50 static NSString* AVVideoScalingModeResizeAspectFill(); | 47 static NSString* AVVideoScalingModeResizeAspectFill(); |
| 51 | 48 |
| 52 static Class AVCaptureSessionClass(); | 49 static Class AVCaptureSessionClass(); |
| 53 static Class AVCaptureVideoDataOutputClass(); | 50 static Class AVCaptureVideoDataOutputClass(); |
| 51 static Class AVCaptureStillImageOutputClass(); |
| 54 #endif // defined(__OBJC__) | 52 #endif // defined(__OBJC__) |
| 55 | 53 |
| 56 private: | 54 private: |
| 57 DISALLOW_IMPLICIT_CONSTRUCTORS(AVFoundationGlue); | 55 DISALLOW_IMPLICIT_CONSTRUCTORS(AVFoundationGlue); |
| 58 }; | 56 }; |
| 59 | 57 |
| 60 #if defined(__OBJC__) | 58 #if defined(__OBJC__) |
| 61 | 59 |
| 62 // Originally AVCaptureDevice and coming from AVCaptureDevice.h | 60 // Originally AVCaptureDevice and coming from AVCaptureDevice.h |
| 63 MEDIA_EXPORT | 61 MEDIA_EXPORT |
| (...skipping 24 matching lines...) Expand all Loading... |
| 88 - (Float64)maxFrameRate; | 86 - (Float64)maxFrameRate; |
| 89 | 87 |
| 90 @end | 88 @end |
| 91 | 89 |
| 92 MEDIA_EXPORT | 90 MEDIA_EXPORT |
| 93 @interface CrAVCaptureInput : NSObject // Originally from AVCaptureInput.h. | 91 @interface CrAVCaptureInput : NSObject // Originally from AVCaptureInput.h. |
| 94 @end | 92 @end |
| 95 | 93 |
| 96 MEDIA_EXPORT | 94 MEDIA_EXPORT |
| 97 @interface CrAVCaptureOutput : NSObject // Originally from AVCaptureOutput.h. | 95 @interface CrAVCaptureOutput : NSObject // Originally from AVCaptureOutput.h. |
| 96 |
| 97 - (NSArray*)connections; |
| 98 |
| 98 @end | 99 @end |
| 99 | 100 |
| 100 // Originally AVCaptureSession and coming from AVCaptureSession.h. | 101 // Originally AVCaptureSession and coming from AVCaptureSession.h. |
| 101 MEDIA_EXPORT | 102 MEDIA_EXPORT |
| 102 @interface CrAVCaptureSession : NSObject | 103 @interface CrAVCaptureSession : NSObject |
| 103 | 104 |
| 104 - (void)release; | 105 - (void)release; |
| 105 - (void)addInput:(CrAVCaptureInput*)input; | 106 - (void)addInput:(CrAVCaptureInput*)input; |
| 106 - (void)removeInput:(CrAVCaptureInput*)input; | 107 - (void)removeInput:(CrAVCaptureInput*)input; |
| 108 - (NSArray*)outputs; |
| 109 - (BOOL)canAddOutput:(CrAVCaptureOutput*)output; |
| 107 - (void)addOutput:(CrAVCaptureOutput*)output; | 110 - (void)addOutput:(CrAVCaptureOutput*)output; |
| 108 - (void)removeOutput:(CrAVCaptureOutput*)output; | 111 - (void)removeOutput:(CrAVCaptureOutput*)output; |
| 109 - (BOOL)isRunning; | 112 - (BOOL)isRunning; |
| 110 - (void)startRunning; | 113 - (void)startRunning; |
| 111 - (void)stopRunning; | 114 - (void)stopRunning; |
| 112 | 115 |
| 113 @end | 116 @end |
| 114 | 117 |
| 115 // Originally AVCaptureConnection and coming from AVCaptureSession.h. | 118 // Originally AVCaptureConnection and coming from AVCaptureSession.h. |
| 116 MEDIA_EXPORT | 119 MEDIA_EXPORT |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 - (void)setSampleBufferDelegate:(id)sampleBufferDelegate | 152 - (void)setSampleBufferDelegate:(id)sampleBufferDelegate |
| 150 queue:(dispatch_queue_t)sampleBufferCallbackQueue; | 153 queue:(dispatch_queue_t)sampleBufferCallbackQueue; |
| 151 | 154 |
| 152 - (void)setAlwaysDiscardsLateVideoFrames:(BOOL)flag; | 155 - (void)setAlwaysDiscardsLateVideoFrames:(BOOL)flag; |
| 153 - (void)setVideoSettings:(NSDictionary*)videoSettings; | 156 - (void)setVideoSettings:(NSDictionary*)videoSettings; |
| 154 - (NSDictionary*)videoSettings; | 157 - (NSDictionary*)videoSettings; |
| 155 - (CrAVCaptureConnection*)connectionWithMediaType:(NSString*)mediaType; | 158 - (CrAVCaptureConnection*)connectionWithMediaType:(NSString*)mediaType; |
| 156 | 159 |
| 157 @end | 160 @end |
| 158 | 161 |
| 162 // Originally AVCaptureStillImageOutput and coming from AVCaptureOutput.h. |
| 163 MEDIA_EXPORT |
| 164 @interface CrAVCaptureStillImageOutput : CrAVCaptureOutput |
| 165 |
| 166 typedef void (^CompletionHandler)(CoreMediaGlue::CMSampleBufferRef, NSError*); |
| 167 - (void) |
| 168 captureStillImageAsynchronouslyFromConnection:(CrAVCaptureConnection*)connection |
| 169 completionHandler:(CompletionHandler)handler; |
| 170 |
| 171 @end |
| 172 |
| 159 // Class to provide access to class methods of AVCaptureDevice. | 173 // Class to provide access to class methods of AVCaptureDevice. |
| 160 MEDIA_EXPORT | 174 MEDIA_EXPORT |
| 161 @interface AVCaptureDeviceGlue : NSObject | 175 @interface AVCaptureDeviceGlue : NSObject |
| 162 | 176 |
| 163 + (NSArray*)devices; | 177 + (NSArray*)devices; |
| 164 | 178 |
| 165 + (CrAVCaptureDevice*)deviceWithUniqueID:(NSString*)deviceUniqueID; | 179 + (CrAVCaptureDevice*)deviceWithUniqueID:(NSString*)deviceUniqueID; |
| 166 | 180 |
| 167 @end | 181 @end |
| 168 | 182 |
| 169 // Class to provide access to class methods of AVCaptureDeviceInput. | 183 // Class to provide access to class methods of AVCaptureDeviceInput. |
| 170 MEDIA_EXPORT | 184 MEDIA_EXPORT |
| 171 @interface AVCaptureDeviceInputGlue : NSObject | 185 @interface AVCaptureDeviceInputGlue : NSObject |
| 172 | 186 |
| 173 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device | 187 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device |
| 174 error:(NSError**)outError; | 188 error:(NSError**)outError; |
| 175 | 189 |
| 176 @end | 190 @end |
| 177 | 191 |
| 178 #endif // defined(__OBJC__) | 192 #endif // defined(__OBJC__) |
| 179 | 193 |
| 180 #endif // MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ | 194 #endif // MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ |
| OLD | NEW |