Agora RTC Objective-C API Reference  Refactor
AgoraMediaIO.h
Go to the documentation of this file.
1 //
2 // AgoraMediaIO.h
3 // AgoraRtcEngineKit
4 //
5 // Copyright (c) 2018 Agora. All rights reserved.
6 //
7 
8 #import <Foundation/Foundation.h>
9 #import <AVFoundation/AVFoundation.h>
10 #import "AgoraEnumerates.h"
11 #import "AgoraObjects.h"
12 
13 
20 typedef NS_ENUM(NSUInteger, AgoraVideoPixelFormat) {
27 };
28 
32 typedef NS_ENUM(NSInteger, AgoraVideoRotation) {
49 };
50 
52 typedef NS_ENUM(NSInteger, AgoraVideoBufferType) {
57 };
58 
64 @protocol AgoraVideoFrameConsumer <NSObject>
65 
72 - (void)consumePixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer
73  withTimestamp:(CMTime)timestamp
74  rotation:(AgoraVideoRotation)rotation NS_SWIFT_NAME(consumePixelBuffer(_:withTimestamp:rotation:));
75 
84 - (void)consumeRawData:(void * _Nonnull)rawData
85  withTimestamp:(CMTime)timestamp
86  format:(AgoraVideoPixelFormat)format
87  size:(CGSize)size
88  rotation:(AgoraVideoRotation)rotation NS_SWIFT_NAME(consumeRawData(_:withTimestamp:format:size:rotation:));
89 @end
90 
114 @protocol AgoraVideoSourceProtocol <NSObject>
115 @required
116 @property (strong) id<AgoraVideoFrameConsumer> _Nullable consumer;
125 - (BOOL)shouldInitialize NS_SWIFT_NAME(shouldInitialize());
126 
137 - (void)shouldStart NS_SWIFT_NAME(shouldStart());
138 
143 - (void)shouldStop NS_SWIFT_NAME(shouldStop());
144 
149 - (void)shouldDispose NS_SWIFT_NAME(shouldDispose());
150 
157 - (AgoraVideoBufferType)bufferType NS_SWIFT_NAME(bufferType());
158 @end
159 
188 @protocol AgoraVideoSinkProtocol <NSObject>
189 @required
197 - (BOOL)shouldInitialize NS_SWIFT_NAME(shouldInitialize());
198 
206 - (void)shouldStart NS_SWIFT_NAME(shouldStart());
207 
212 - (void)shouldStop NS_SWIFT_NAME(shouldStop());
213 
218 - (void)shouldDispose NS_SWIFT_NAME(shouldDispose());
219 
224 - (AgoraVideoBufferType)bufferType NS_SWIFT_NAME(bufferType());
225 
230 - (AgoraVideoPixelFormat)pixelFormat NS_SWIFT_NAME(pixelFormat());
231 
232 @optional
238 - (void)renderPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer
239  rotation:(AgoraVideoRotation)rotation NS_SWIFT_NAME(renderPixelBuffer(_:rotation:));
240 
247 - (void)renderRawData:(void * _Nonnull)rawData
248  size:(CGSize)size
249  rotation:(AgoraVideoRotation)rotation NS_SWIFT_NAME(renderRawData(_:size:rotation:));
250 @end
251 
252 
253 #pragma mark - Agora Default Media IO
254 
255 typedef NS_ENUM(NSInteger, AgoraRtcDefaultCameraPosition) {
257  AgoraRtcDefaultCameraPositionFront = 0,
259  AgoraRtcDefaultCameraPositionBack = 1,
260 };
261 
262 __attribute__((visibility("default"))) @interface AgoraRtcDefaultCamera: NSObject<AgoraVideoSourceProtocol>
263 #if TARGET_OS_IPHONE
264 @property (nonatomic, assign) AgoraRtcDefaultCameraPosition position;
265 - (instancetype _Nonnull)initWithPosition:(AgoraRtcDefaultCameraPosition)position NS_SWIFT_NAME(initWithPosition(_:));
266 #endif
267 @end
268 
269 #if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC))
270 __attribute__((visibility("default"))) @interface AgoraRtcScreenCapture: NSObject<AgoraVideoSourceProtocol>
271 @property (nonatomic, readonly) NSUInteger windowId;
272 + (instancetype _Nonnull)fullScreenCaptureWithFrequency:(NSInteger)captureFrequency
273  bitRate:(NSInteger)bitRate NS_SWIFT_NAME(fullScreenCaptureWithFrequency(_:bitRate:));
274 + (instancetype _Nonnull)windowCaptureWithId:(CGWindowID)windowId
275  captureFrequency:(NSInteger)captureFrequency
276  bitRate:(NSInteger)bitRate
277  rect:(CGRect)rect NS_SWIFT_NAME(windowCaptureWithId(_:captureFrequency:bitRate:rect:));
278 @end
279 #endif
280 
281 __attribute__((visibility("default"))) @interface AgoraRtcDefaultRenderer: NSObject<AgoraVideoSinkProtocol>
282 @property (nonatomic, strong, readonly) VIEW_CLASS * _Nonnull view;
283 @property (nonatomic, assign) AgoraVideoRenderMode mode;
284 - (instancetype _Nonnull)initWithView:(VIEW_CLASS * _Nonnull)view
285  renderMode:(AgoraVideoRenderMode)mode NS_SWIFT_NAME(initWithView(_:renderMode:));
286 @end
AgoraVideoBufferType
AgoraVideoBufferType
Definition: AgoraMediaIO.h:52
AgoraVideoPixelFormatI420
@ AgoraVideoPixelFormatI420
Definition: AgoraMediaIO.h:22
AgoraEnumerates.h
AgoraVideoRotation90
@ AgoraVideoRotation90
Definition: AgoraMediaIO.h:40
AgoraVideoPixelFormatBGRA
@ AgoraVideoPixelFormatBGRA
Definition: AgoraMediaIO.h:24
AgoraVideoBufferTypePixelBuffer
@ AgoraVideoBufferTypePixelBuffer
Definition: AgoraMediaIO.h:54
AgoraVideoRotation270
@ AgoraVideoRotation270
Definition: AgoraMediaIO.h:48
AgoraVideoRotationNone
@ AgoraVideoRotationNone
Definition: AgoraMediaIO.h:36
AgoraVideoPixelFormat
AgoraVideoPixelFormat
Definition: AgoraMediaIO.h:20
VIEW_CLASS
UIView VIEW_CLASS
Definition: AgoraObjects.h:14
AgoraVideoRenderMode
AgoraVideoRenderMode
Video display modes.
Definition: AgoraEnumerates.h:1256
AgoraVideoRotation
AgoraVideoRotation
The clockwise rotation of the video.
Definition: AgoraMediaIO.h:32
AgoraObjects.h
AgoraVideoRotation180
@ AgoraVideoRotation180
Definition: AgoraMediaIO.h:44
AgoraVideoPixelFormatNV12
@ AgoraVideoPixelFormatNV12
Definition: AgoraMediaIO.h:26
AgoraVideoBufferTypeRawData
@ AgoraVideoBufferTypeRawData
Definition: AgoraMediaIO.h:56