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