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