OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 // TODO(mcasas): Remove this whole glue, https://crbug.com/579648. This glue was | |
6 // introduced to support Mac OS X <= 10.6 where AVFoundation was not available, | |
7 // and had to happen in runtime. | |
8 | |
9 #ifndef MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ | |
10 #define MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ | |
11 | |
12 #if defined(__OBJC__) | |
13 #import <Foundation/Foundation.h> | |
14 #endif // defined(__OBJC__) | |
15 | |
16 #include <stdint.h> | |
17 | |
18 #include "base/macros.h" | |
19 #include "media/base/mac/coremedia_glue.h" | |
20 #include "media/base/media_export.h" | |
21 | |
22 class MEDIA_EXPORT AVFoundationGlue { | |
23 public: | |
24 // Must be called on the UI thread prior to attempting to use any other | |
25 // AVFoundation methods. | |
26 static void InitializeAVFoundation(); | |
27 | |
28 #if defined(__OBJC__) | |
29 static NSBundle const* AVFoundationBundle(); | |
30 | |
31 // Originally coming from AVCaptureDevice.h but in global namespace. | |
32 static NSString* AVCaptureDeviceWasConnectedNotification(); | |
33 static NSString* AVCaptureDeviceWasDisconnectedNotification(); | |
34 | |
35 // Originally coming from AVMediaFormat.h but in global namespace. | |
36 static NSString* AVMediaTypeVideo(); | |
37 static NSString* AVMediaTypeAudio(); | |
38 static NSString* AVMediaTypeMuxed(); | |
39 | |
40 // Originally from AVCaptureSession.h but in global namespace. | |
41 static NSString* AVCaptureSessionRuntimeErrorNotification(); | |
42 static NSString* AVCaptureSessionDidStopRunningNotification(); | |
43 static NSString* AVCaptureSessionErrorKey(); | |
44 | |
45 // Originally from AVVideoSettings.h but in global namespace. | |
46 static NSString* AVVideoScalingModeKey(); | |
47 static NSString* AVVideoScalingModeResizeAspectFill(); | |
48 | |
49 static Class AVCaptureSessionClass(); | |
50 static Class AVCaptureVideoDataOutputClass(); | |
51 static Class AVCaptureStillImageOutputClass(); | |
52 #endif // defined(__OBJC__) | |
53 | |
54 private: | |
55 DISALLOW_IMPLICIT_CONSTRUCTORS(AVFoundationGlue); | |
56 }; | |
57 | |
58 #if defined(__OBJC__) | |
59 | |
60 // Originally AVCaptureDevice and coming from AVCaptureDevice.h | |
61 MEDIA_EXPORT | |
62 @interface CrAVCaptureDevice : NSObject | |
63 | |
64 - (BOOL)hasMediaType:(NSString*)mediaType; | |
65 - (NSString*)uniqueID; | |
66 - (NSString*)localizedName; | |
67 - (BOOL)isSuspended; | |
68 - (NSArray*)formats; | |
69 - (int32_t)transportType; | |
70 | |
71 @end | |
72 | |
73 // Originally AVCaptureDeviceFormat and coming from AVCaptureDevice.h. | |
74 MEDIA_EXPORT | |
75 @interface CrAVCaptureDeviceFormat : NSObject | |
76 | |
77 - (CoreMediaGlue::CMFormatDescriptionRef)formatDescription; | |
78 - (NSArray*)videoSupportedFrameRateRanges; | |
79 | |
80 @end | |
81 | |
82 // Originally AVFrameRateRange and coming from AVCaptureDevice.h. | |
83 MEDIA_EXPORT | |
84 @interface CrAVFrameRateRange : NSObject | |
85 | |
86 - (Float64)maxFrameRate; | |
87 | |
88 @end | |
89 | |
90 MEDIA_EXPORT | |
91 @interface CrAVCaptureInput : NSObject // Originally from AVCaptureInput.h. | |
92 @end | |
93 | |
94 MEDIA_EXPORT | |
95 @interface CrAVCaptureOutput : NSObject // Originally from AVCaptureOutput.h. | |
96 | |
97 - (NSArray*)connections; | |
98 | |
99 @end | |
100 | |
101 // Originally AVCaptureSession and coming from AVCaptureSession.h. | |
102 MEDIA_EXPORT | |
103 @interface CrAVCaptureSession : NSObject | |
104 | |
105 - (void)release; | |
106 - (void)addInput:(CrAVCaptureInput*)input; | |
107 - (void)removeInput:(CrAVCaptureInput*)input; | |
108 - (NSArray*)outputs; | |
109 - (BOOL)canAddOutput:(CrAVCaptureOutput*)output; | |
110 - (void)addOutput:(CrAVCaptureOutput*)output; | |
111 - (void)removeOutput:(CrAVCaptureOutput*)output; | |
112 - (BOOL)isRunning; | |
113 - (void)startRunning; | |
114 - (void)stopRunning; | |
115 | |
116 @end | |
117 | |
118 // Originally AVCaptureConnection and coming from AVCaptureSession.h. | |
119 MEDIA_EXPORT | |
120 @interface CrAVCaptureConnection : NSObject | |
121 | |
122 - (BOOL)isVideoMinFrameDurationSupported; | |
123 - (void)setVideoMinFrameDuration:(CoreMediaGlue::CMTime)minFrameRate; | |
124 - (BOOL)isVideoMaxFrameDurationSupported; | |
125 - (void)setVideoMaxFrameDuration:(CoreMediaGlue::CMTime)maxFrameRate; | |
126 | |
127 @end | |
128 | |
129 // Originally AVCaptureDeviceInput and coming from AVCaptureInput.h. | |
130 MEDIA_EXPORT | |
131 @interface CrAVCaptureDeviceInput : CrAVCaptureInput | |
132 | |
133 @end | |
134 | |
135 // Originally AVCaptureVideoDataOutputSampleBufferDelegate from | |
136 // AVCaptureOutput.h. | |
137 @protocol CrAVCaptureVideoDataOutputSampleBufferDelegate <NSObject> | |
138 | |
139 @optional | |
140 | |
141 - (void)captureOutput:(CrAVCaptureOutput*)captureOutput | |
142 didOutputSampleBuffer:(CoreMediaGlue::CMSampleBufferRef)sampleBuffer | |
143 fromConnection:(CrAVCaptureConnection*)connection; | |
144 | |
145 @end | |
146 | |
147 // Originally AVCaptureVideoDataOutput and coming from AVCaptureOutput.h. | |
148 MEDIA_EXPORT | |
149 @interface CrAVCaptureVideoDataOutput : CrAVCaptureOutput | |
150 | |
151 - (oneway void)release; | |
152 - (void)setSampleBufferDelegate:(id)sampleBufferDelegate | |
153 queue:(dispatch_queue_t)sampleBufferCallbackQueue; | |
154 | |
155 - (void)setAlwaysDiscardsLateVideoFrames:(BOOL)flag; | |
156 - (void)setVideoSettings:(NSDictionary*)videoSettings; | |
157 - (NSDictionary*)videoSettings; | |
158 - (CrAVCaptureConnection*)connectionWithMediaType:(NSString*)mediaType; | |
159 | |
160 @end | |
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 | |
173 // Class to provide access to class methods of AVCaptureDevice. | |
174 MEDIA_EXPORT | |
175 @interface AVCaptureDeviceGlue : NSObject | |
176 | |
177 + (NSArray*)devices; | |
178 | |
179 + (CrAVCaptureDevice*)deviceWithUniqueID:(NSString*)deviceUniqueID; | |
180 | |
181 @end | |
182 | |
183 // Class to provide access to class methods of AVCaptureDeviceInput. | |
184 MEDIA_EXPORT | |
185 @interface AVCaptureDeviceInputGlue : NSObject | |
186 | |
187 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device | |
188 error:(NSError**)outError; | |
189 | |
190 @end | |
191 | |
192 #endif // defined(__OBJC__) | |
193 | |
194 #endif // MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ | |
OLD | NEW |