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 - (BOOL)canAddOutput:(CrAVCaptureOutput*)output; | |
110 - (void)addOutput:(CrAVCaptureOutput*)output; | 107 - (void)addOutput:(CrAVCaptureOutput*)output; |
111 - (void)removeOutput:(CrAVCaptureOutput*)output; | 108 - (void)removeOutput:(CrAVCaptureOutput*)output; |
112 - (BOOL)isRunning; | 109 - (BOOL)isRunning; |
113 - (void)startRunning; | 110 - (void)startRunning; |
114 - (void)stopRunning; | 111 - (void)stopRunning; |
115 | 112 |
116 @end | 113 @end |
117 | 114 |
118 // Originally AVCaptureConnection and coming from AVCaptureSession.h. | 115 // Originally AVCaptureConnection and coming from AVCaptureSession.h. |
119 MEDIA_EXPORT | 116 MEDIA_EXPORT |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 - (void)setSampleBufferDelegate:(id)sampleBufferDelegate | 149 - (void)setSampleBufferDelegate:(id)sampleBufferDelegate |
153 queue:(dispatch_queue_t)sampleBufferCallbackQueue; | 150 queue:(dispatch_queue_t)sampleBufferCallbackQueue; |
154 | 151 |
155 - (void)setAlwaysDiscardsLateVideoFrames:(BOOL)flag; | 152 - (void)setAlwaysDiscardsLateVideoFrames:(BOOL)flag; |
156 - (void)setVideoSettings:(NSDictionary*)videoSettings; | 153 - (void)setVideoSettings:(NSDictionary*)videoSettings; |
157 - (NSDictionary*)videoSettings; | 154 - (NSDictionary*)videoSettings; |
158 - (CrAVCaptureConnection*)connectionWithMediaType:(NSString*)mediaType; | 155 - (CrAVCaptureConnection*)connectionWithMediaType:(NSString*)mediaType; |
159 | 156 |
160 @end | 157 @end |
161 | 158 |
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 | |
173 // Class to provide access to class methods of AVCaptureDevice. | 159 // Class to provide access to class methods of AVCaptureDevice. |
174 MEDIA_EXPORT | 160 MEDIA_EXPORT |
175 @interface AVCaptureDeviceGlue : NSObject | 161 @interface AVCaptureDeviceGlue : NSObject |
176 | 162 |
177 + (NSArray*)devices; | 163 + (NSArray*)devices; |
178 | 164 |
179 + (CrAVCaptureDevice*)deviceWithUniqueID:(NSString*)deviceUniqueID; | 165 + (CrAVCaptureDevice*)deviceWithUniqueID:(NSString*)deviceUniqueID; |
180 | 166 |
181 @end | 167 @end |
182 | 168 |
183 // Class to provide access to class methods of AVCaptureDeviceInput. | 169 // Class to provide access to class methods of AVCaptureDeviceInput. |
184 MEDIA_EXPORT | 170 MEDIA_EXPORT |
185 @interface AVCaptureDeviceInputGlue : NSObject | 171 @interface AVCaptureDeviceInputGlue : NSObject |
186 | 172 |
187 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device | 173 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device |
188 error:(NSError**)outError; | 174 error:(NSError**)outError; |
189 | 175 |
190 @end | 176 @end |
191 | 177 |
192 #endif // defined(__OBJC__) | 178 #endif // defined(__OBJC__) |
193 | 179 |
194 #endif // MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ | 180 #endif // MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ |
OLD | NEW |