Use UsbIds::GetVendorName to retrieve USB vendor name.
[chromium-blink-merge.git] / media / base / mac / avfoundation_glue.h
blobc1b8aa8f0edb05f11a6aac2c3a56e892c4acb3ae
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.
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
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.
12 #ifndef MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_
13 #define MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_
15 #import <Foundation/Foundation.h>
17 #include "base/basictypes.h"
18 #include "media/base/mac/coremedia_glue.h"
19 #include "media/base/media_export.h"
21 class MEDIA_EXPORT AVFoundationGlue {
22 public:
23 // This method returns true if the OS version supports AVFoundation and the
24 // AVFoundation bundle could be loaded correctly, or false otherwise.
25 static bool IsAVFoundationSupported();
27 static NSBundle const* AVFoundationBundle();
29 // Originally coming from AVCaptureDevice.h but in global namespace.
30 static NSString* AVCaptureDeviceWasConnectedNotification();
31 static NSString* AVCaptureDeviceWasDisconnectedNotification();
33 // Originally coming from AVMediaFormat.h but in global namespace.
34 static NSString* AVMediaTypeVideo();
35 static NSString* AVMediaTypeAudio();
36 static NSString* AVMediaTypeMuxed();
38 // Originally from AVCaptureSession.h but in global namespace.
39 static NSString* AVCaptureSessionRuntimeErrorNotification();
40 static NSString* AVCaptureSessionDidStopRunningNotification();
41 static NSString* AVCaptureSessionErrorKey();
43 // Originally from AVVideoSettings.h but in global namespace.
44 static NSString* AVVideoScalingModeKey();
45 static NSString* AVVideoScalingModeResizeAspectFill();
47 static Class AVCaptureSessionClass();
48 static Class AVCaptureVideoDataOutputClass();
50 private:
51 DISALLOW_IMPLICIT_CONSTRUCTORS(AVFoundationGlue);
54 // Originally AVCaptureDevice and coming from AVCaptureDevice.h
55 MEDIA_EXPORT
56 @interface CrAVCaptureDevice : NSObject
58 - (BOOL)hasMediaType:(NSString*)mediaType;
59 - (NSString*)uniqueID;
60 - (NSString*)localizedName;
61 - (BOOL)isSuspended;
62 - (NSArray*)formats;
63 - (int32_t)transportType;
65 @end
67 // Originally AVCaptureDeviceFormat and coming from AVCaptureDevice.h.
68 MEDIA_EXPORT
69 @interface CrAVCaptureDeviceFormat : NSObject
71 - (CoreMediaGlue::CMFormatDescriptionRef)formatDescription;
72 - (NSArray*)videoSupportedFrameRateRanges;
74 @end
76 // Originally AVFrameRateRange and coming from AVCaptureDevice.h.
77 MEDIA_EXPORT
78 @interface CrAVFrameRateRange : NSObject
80 - (Float64)maxFrameRate;
82 @end
84 MEDIA_EXPORT
85 @interface CrAVCaptureInput // Originally from AVCaptureInput.h.
86 @end
88 MEDIA_EXPORT
89 @interface CrAVCaptureOutput // Originally from AVCaptureOutput.h.
90 @end
92 // Originally AVCaptureSession and coming from AVCaptureSession.h.
93 MEDIA_EXPORT
94 @interface CrAVCaptureSession : NSObject
96 - (void)release;
97 - (void)addInput:(CrAVCaptureInput*)input;
98 - (void)removeInput:(CrAVCaptureInput*)input;
99 - (void)addOutput:(CrAVCaptureOutput*)output;
100 - (void)removeOutput:(CrAVCaptureOutput*)output;
101 - (BOOL)isRunning;
102 - (void)startRunning;
103 - (void)stopRunning;
105 @end
107 // Originally AVCaptureConnection and coming from AVCaptureSession.h.
108 MEDIA_EXPORT
109 @interface CrAVCaptureConnection : NSObject
111 - (BOOL)isVideoMinFrameDurationSupported;
112 - (void)setVideoMinFrameDuration:(CoreMediaGlue::CMTime)minFrameRate;
113 - (BOOL)isVideoMaxFrameDurationSupported;
114 - (void)setVideoMaxFrameDuration:(CoreMediaGlue::CMTime)maxFrameRate;
116 @end
118 // Originally AVCaptureDeviceInput and coming from AVCaptureInput.h.
119 MEDIA_EXPORT
120 @interface CrAVCaptureDeviceInput : CrAVCaptureInput
122 @end
124 // Originally AVCaptureVideoDataOutputSampleBufferDelegate from
125 // AVCaptureOutput.h.
126 @protocol CrAVCaptureVideoDataOutputSampleBufferDelegate <NSObject>
128 @optional
130 - (void)captureOutput:(CrAVCaptureOutput*)captureOutput
131 didOutputSampleBuffer:(CoreMediaGlue::CMSampleBufferRef)sampleBuffer
132 fromConnection:(CrAVCaptureConnection*)connection;
134 @end
136 // Originally AVCaptureVideoDataOutput and coming from AVCaptureOutput.h.
137 MEDIA_EXPORT
138 @interface CrAVCaptureVideoDataOutput : CrAVCaptureOutput
140 - (oneway void)release;
141 - (void)setSampleBufferDelegate:(id)sampleBufferDelegate
142 queue:(dispatch_queue_t)sampleBufferCallbackQueue;
144 - (void)setAlwaysDiscardsLateVideoFrames:(BOOL)flag;
145 - (void)setVideoSettings:(NSDictionary*)videoSettings;
146 - (NSDictionary*)videoSettings;
147 - (CrAVCaptureConnection*)connectionWithMediaType:(NSString*)mediaType;
149 @end
151 // Class to provide access to class methods of AVCaptureDevice.
152 MEDIA_EXPORT
153 @interface AVCaptureDeviceGlue : NSObject
155 + (NSArray*)devices;
157 + (CrAVCaptureDevice*)deviceWithUniqueID:(NSString*)deviceUniqueID;
159 @end
161 // Class to provide access to class methods of AVCaptureDeviceInput.
162 MEDIA_EXPORT
163 @interface AVCaptureDeviceInputGlue : NSObject
165 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device
166 error:(NSError**)outError;
168 @end
170 #endif // MEDIA_BASE_MAC_AVFOUNDATION_GLUE_H_