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 // AVFoundation API is only introduced in Mac OS X > 10.6, and there is only one |
6 // build of Chromium, so the (potential) linking with AVFoundation has to happen | 6 // build of Chromium, so the (potential) linking with AVFoundation has to happen |
7 // in runtime. For this to be clean, an AVFoundationGlue class is defined to try | 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 | 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 | 9 // clients can use AVFoundation via the rest of the classes declared in this |
10 // file. | 10 // file. |
11 | 11 |
12 #ifndef MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ | 12 #ifndef MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ |
13 #define MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ | 13 #define MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ |
14 | 14 |
15 #if defined(__OBJC__) | |
jam
2015/05/26 23:13:47
why are all these changes needed in this file? sho
tommi (sloooow) - chröme
2015/05/27 09:11:02
It's only defined when building .mm files, not whe
| |
15 #import <Foundation/Foundation.h> | 16 #import <Foundation/Foundation.h> |
17 #endif // defined(__OBJC__) | |
16 | 18 |
17 #include "base/basictypes.h" | 19 #include "base/basictypes.h" |
18 #include "media/base/mac/coremedia_glue.h" | 20 #include "media/base/mac/coremedia_glue.h" |
19 #include "media/base/media_export.h" | 21 #include "media/base/media_export.h" |
20 | 22 |
21 class MEDIA_EXPORT AVFoundationGlue { | 23 class MEDIA_EXPORT AVFoundationGlue { |
22 public: | 24 public: |
25 // Must be called on the UI thread prior to attempting to use any other | |
26 // AVFoundation methods. | |
27 static void InitializeAVFoundation(); | |
28 | |
23 // This method returns true if the OS version supports AVFoundation and the | 29 // This method returns true if the OS version supports AVFoundation and the |
24 // AVFoundation bundle could be loaded correctly, or false otherwise. | 30 // AVFoundation bundle could be loaded correctly, or false otherwise. |
25 static bool IsAVFoundationSupported(); | 31 static bool IsAVFoundationSupported(); |
26 | 32 |
33 #if defined(__OBJC__) | |
27 static NSBundle const* AVFoundationBundle(); | 34 static NSBundle const* AVFoundationBundle(); |
28 | 35 |
29 // Originally coming from AVCaptureDevice.h but in global namespace. | 36 // Originally coming from AVCaptureDevice.h but in global namespace. |
30 static NSString* AVCaptureDeviceWasConnectedNotification(); | 37 static NSString* AVCaptureDeviceWasConnectedNotification(); |
31 static NSString* AVCaptureDeviceWasDisconnectedNotification(); | 38 static NSString* AVCaptureDeviceWasDisconnectedNotification(); |
32 | 39 |
33 // Originally coming from AVMediaFormat.h but in global namespace. | 40 // Originally coming from AVMediaFormat.h but in global namespace. |
34 static NSString* AVMediaTypeVideo(); | 41 static NSString* AVMediaTypeVideo(); |
35 static NSString* AVMediaTypeAudio(); | 42 static NSString* AVMediaTypeAudio(); |
36 static NSString* AVMediaTypeMuxed(); | 43 static NSString* AVMediaTypeMuxed(); |
37 | 44 |
38 // Originally from AVCaptureSession.h but in global namespace. | 45 // Originally from AVCaptureSession.h but in global namespace. |
39 static NSString* AVCaptureSessionRuntimeErrorNotification(); | 46 static NSString* AVCaptureSessionRuntimeErrorNotification(); |
40 static NSString* AVCaptureSessionDidStopRunningNotification(); | 47 static NSString* AVCaptureSessionDidStopRunningNotification(); |
41 static NSString* AVCaptureSessionErrorKey(); | 48 static NSString* AVCaptureSessionErrorKey(); |
42 | 49 |
43 // Originally from AVVideoSettings.h but in global namespace. | 50 // Originally from AVVideoSettings.h but in global namespace. |
44 static NSString* AVVideoScalingModeKey(); | 51 static NSString* AVVideoScalingModeKey(); |
45 static NSString* AVVideoScalingModeResizeAspectFill(); | 52 static NSString* AVVideoScalingModeResizeAspectFill(); |
46 | 53 |
47 static Class AVCaptureSessionClass(); | 54 static Class AVCaptureSessionClass(); |
48 static Class AVCaptureVideoDataOutputClass(); | 55 static Class AVCaptureVideoDataOutputClass(); |
56 #endif // defined(__OBJC__) | |
49 | 57 |
50 private: | 58 private: |
51 DISALLOW_IMPLICIT_CONSTRUCTORS(AVFoundationGlue); | 59 DISALLOW_IMPLICIT_CONSTRUCTORS(AVFoundationGlue); |
52 }; | 60 }; |
53 | 61 |
62 #if defined(__OBJC__) | |
63 | |
54 // Originally AVCaptureDevice and coming from AVCaptureDevice.h | 64 // Originally AVCaptureDevice and coming from AVCaptureDevice.h |
55 MEDIA_EXPORT | 65 MEDIA_EXPORT |
56 @interface CrAVCaptureDevice : NSObject | 66 @interface CrAVCaptureDevice : NSObject |
57 | 67 |
58 - (BOOL)hasMediaType:(NSString*)mediaType; | 68 - (BOOL)hasMediaType:(NSString*)mediaType; |
59 - (NSString*)uniqueID; | 69 - (NSString*)uniqueID; |
60 - (NSString*)localizedName; | 70 - (NSString*)localizedName; |
61 - (BOOL)isSuspended; | 71 - (BOOL)isSuspended; |
62 - (NSArray*)formats; | 72 - (NSArray*)formats; |
63 - (int32_t)transportType; | 73 - (int32_t)transportType; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 | 170 |
161 // Class to provide access to class methods of AVCaptureDeviceInput. | 171 // Class to provide access to class methods of AVCaptureDeviceInput. |
162 MEDIA_EXPORT | 172 MEDIA_EXPORT |
163 @interface AVCaptureDeviceInputGlue : NSObject | 173 @interface AVCaptureDeviceInputGlue : NSObject |
164 | 174 |
165 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device | 175 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device |
166 error:(NSError**)outError; | 176 error:(NSError**)outError; |
167 | 177 |
168 @end | 178 @end |
169 | 179 |
180 #endif // defined(__OBJC__) | |
181 | |
170 #endif // MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ | 182 #endif // MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_ |
OLD | NEW |