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) {
22 AgoraVideoPixelFormatI420 = 1,
24 AgoraVideoPixelFormatBGRA = 2,
26 AgoraVideoPixelFormatNV12 = 8,
27 };
28
33 typedef NS_ENUM(NSInteger, AgoraVideoRotation) {
35 AgoraVideoRotationNone = 0,
37 AgoraVideoRotation90 = 90,
39 AgoraVideoRotation180 = 180,
41 AgoraVideoRotation270 = 270,
42 };
43
45 typedef NS_ENUM(NSInteger, AgoraVideoBufferType) {
47 AgoraVideoBufferTypePixelBuffer = 1,
49 AgoraVideoBufferTypeRawData = 2,
50 };
51
57 @protocol AgoraVideoFrameConsumer <NSObject>
58
65 - (void)consumePixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer
66 withTimestamp:(CMTime)timestamp
67 rotation:(AgoraVideoRotation)rotation NS_SWIFT_NAME(consumePixelBuffer(_:withTimestamp:rotation:));
68
77 - (void)consumeRawData:(void * _Nonnull)rawData
78 withTimestamp:(CMTime)timestamp
79 format:(AgoraVideoPixelFormat)format
80 size:(CGSize)size
81 rotation:(AgoraVideoRotation)rotation NS_SWIFT_NAME(consumeRawData(_:withTimestamp:format:size:rotation:));
82 @end
83
107 @protocol AgoraVideoSourceProtocol <NSObject>
108 @required
109 @property (strong) id<AgoraVideoFrameConsumer> _Nullable consumer;
118 - (BOOL)shouldInitialize NS_SWIFT_NAME(shouldInitialize());
119
130 - (void)shouldStart NS_SWIFT_NAME(shouldStart());
131
136 - (void)shouldStop NS_SWIFT_NAME(shouldStop());
137
142 - (void)shouldDispose NS_SWIFT_NAME(shouldDispose());
143
150 - (AgoraVideoBufferType)bufferType NS_SWIFT_NAME(bufferType());
151 @end
152
181 @protocol AgoraVideoSinkProtocol <NSObject>
182 @required
190 - (BOOL)shouldInitialize NS_SWIFT_NAME(shouldInitialize());
191
199 - (void)shouldStart NS_SWIFT_NAME(shouldStart());
200
205 - (void)shouldStop NS_SWIFT_NAME(shouldStop());
206
211 - (void)shouldDispose NS_SWIFT_NAME(shouldDispose());
212
217 - (AgoraVideoBufferType)bufferType NS_SWIFT_NAME(bufferType());
218
223 - (AgoraVideoPixelFormat)pixelFormat NS_SWIFT_NAME(pixelFormat());
224
225 @optional
231 - (void)renderPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer
232 rotation:(AgoraVideoRotation)rotation NS_SWIFT_NAME(renderPixelBuffer(_:rotation:));
233
240 - (void)renderRawData:(void * _Nonnull)rawData
241 size:(CGSize)size
242 rotation:(AgoraVideoRotation)rotation NS_SWIFT_NAME(renderRawData(_:size: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 NS_SWIFT_NAME(initWithPosition(_:));
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 NS_SWIFT_NAME(fullScreenCaptureWithFrequency(_:bitRate:));
267 + (instancetype _Nonnull)windowCaptureWithId:(CGWindowID)windowId
268 captureFrequency:(NSInteger)captureFrequency
269 bitRate:(NSInteger)bitRate
270 rect:(CGRect)rect NS_SWIFT_NAME(windowCaptureWithId(_:captureFrequency:bitRate: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 NS_SWIFT_NAME(initWithView(_:renderMode:));
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:14
AgoraVideoRenderMode
AgoraVideoRenderMode
Definition: AgoraEnumerates.h:847
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