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 
33 typedef NS_ENUM(NSInteger, AgoraVideoRotation) {
42 };
43 
45 typedef NS_ENUM(NSInteger, AgoraVideoBufferType) {
50 };
51 
57 @protocol AgoraVideoFrameConsumer <NSObject>
58 
65 - (void)consumePixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer
66  withTimestamp:(CMTime)timestamp
67  rotation:(AgoraVideoRotation)rotation;
68 
77 - (void)consumeRawData:(void * _Nonnull)rawData
78  withTimestamp:(CMTime)timestamp
79  format:(AgoraVideoPixelFormat)format
80  size:(CGSize)size
81  rotation:(AgoraVideoRotation)rotation;
82 @end
83 
107 @protocol AgoraVideoSourceProtocol <NSObject>
108 @required
109 @property (strong) id<AgoraVideoFrameConsumer> _Nullable consumer;
118 - (BOOL)shouldInitialize;
119 
130 - (void)shouldStart;
131 
136 - (void)shouldStop;
137 
142 - (void)shouldDispose;
143 
150 - (AgoraVideoBufferType)bufferType;
151 @end
152 
181 @protocol AgoraVideoSinkProtocol <NSObject>
182 @required
190 - (BOOL)shouldInitialize;
191 
199 - (void)shouldStart;
200 
205 - (void)shouldStop;
206 
211 - (void)shouldDispose;
212 
217 - (AgoraVideoBufferType)bufferType;
218 
223 - (AgoraVideoPixelFormat)pixelFormat;
224 
225 @optional
231 - (void)renderPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer
232  rotation:(AgoraVideoRotation)rotation;
233 
240 - (void)renderRawData:(void * _Nonnull)rawData
241  size:(CGSize)size
242  rotation:(AgoraVideoRotation)rotation;
243 @end
244 
245 
246 #pragma mark - Agora Default Media IO
247 
248 typedef NS_ENUM(NSInteger, AgoraRtcDefaultCameraPosition) {
250  AgoraRtcDefaultCameraPositionFront = 0,
252  AgoraRtcDefaultCameraPositionBack = 1,
253 };
254 
255 __attribute__((visibility("default"))) @interface AgoraRtcDefaultCamera: NSObject<AgoraVideoSourceProtocol>
256 #if TARGET_OS_IPHONE
257 @property (nonatomic, assign) AgoraRtcDefaultCameraPosition position;
258 - (instancetype _Nonnull)initWithPosition:(AgoraRtcDefaultCameraPosition)position;
259 #endif
260 @end
261 
262 #if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC))
263 __attribute__((visibility("default"))) @interface AgoraRtcScreenCapture: NSObject<AgoraVideoSourceProtocol>
264 @property (nonatomic, readonly) NSUInteger windowId;
265 + (instancetype _Nonnull)fullScreenCaptureWithFrequency:(NSInteger)captureFrequency
266  bitRate:(NSInteger)bitRate;
267 + (instancetype _Nonnull)windowCaptureWithId:(CGWindowID)windowId
268  captureFrequency:(NSInteger)captureFrequency
269  bitRate:(NSInteger)bitRate
270  rect:(CGRect)rect;
271 @end
272 #endif
273 
274 __attribute__((visibility("default"))) @interface AgoraRtcDefaultRenderer: NSObject<AgoraVideoSinkProtocol>
275 @property (nonatomic, strong, readonly) VIEW_CLASS * _Nonnull view;
276 @property (nonatomic, assign) AgoraVideoRenderMode mode;
277 - (instancetype _Nonnull)initWithView:(VIEW_CLASS * _Nonnull)view
278  renderMode:(AgoraVideoRenderMode)mode;
279 @end
AgoraVideoBufferType
AgoraVideoBufferType
Definition: AgoraMediaIO.h:45
AgoraVideoPixelFormatI420
@ AgoraVideoPixelFormatI420
Definition: AgoraMediaIO.h:22
AgoraEnumerates.h
AgoraVideoRotation90
@ AgoraVideoRotation90
Definition: AgoraMediaIO.h:37
AgoraVideoPixelFormatBGRA
@ AgoraVideoPixelFormatBGRA
Definition: AgoraMediaIO.h:24
AgoraVideoBufferTypePixelBuffer
@ AgoraVideoBufferTypePixelBuffer
Definition: AgoraMediaIO.h:47
AgoraVideoRotation270
@ AgoraVideoRotation270
Definition: AgoraMediaIO.h:41
AgoraVideoRotationNone
@ AgoraVideoRotationNone
Definition: AgoraMediaIO.h:35
AgoraVideoPixelFormat
AgoraVideoPixelFormat
Definition: AgoraMediaIO.h:20
VIEW_CLASS
UIView VIEW_CLASS
Definition: AgoraObjects.h:16
AgoraVideoRenderMode
AgoraVideoRenderMode
Definition: AgoraEnumerates.h:753
AgoraVideoRotation
AgoraVideoRotation
Definition: AgoraMediaIO.h:33
AgoraObjects.h
AgoraVideoRotation180
@ AgoraVideoRotation180
Definition: AgoraMediaIO.h:39
AgoraVideoPixelFormatNV12
@ AgoraVideoPixelFormatNV12
Definition: AgoraMediaIO.h:26
AgoraVideoBufferTypeRawData
@ AgoraVideoBufferTypeRawData
Definition: AgoraMediaIO.h:49