AgoraOutputVideoFrame
视频帧的配置信息。
Objective-C
@interface AgoraOutputVideoFrame : NSObject
@property (nonatomic, assign) NSInteger type;
@property (nonatomic, assign) int width;
@property (nonatomic, assign) int height;
@property (nonatomic, assign) int yStride;
@property (nonatomic, assign) int uStride;
@property (nonatomic, assign) int vStride;
@property (nonatomic, assign) uint8_t* _Nullable yBuffer;
@property (nonatomic, assign) uint8_t* _Nullable uBuffer;
@property (nonatomic, assign) uint8_t* _Nullable vBuffer;
@property (nonatomic, assign) int rotation;
@property (nonatomic, assign) int64_t renderTimeMs;
@property (nonatomic, assign) int avSyncType;
@property(assign, nonatomic) CVPixelBufferRef _Nullable pixelBuffer;
@property (nonatomic, assign) uint8_t* _Nullable alphaBuffer;
@property (nonatomic, assign) AgoraAlphaStitchMode alphaStitchMode;
@property(nonatomic, strong) NSDictionary *_Nonnull metaInfo;
@property(nonatomic, strong) AgoraColorSpace* _Nullable colorSpace;
@end
缓冲区提供的是指针的指针。该接口无法修改缓冲区的指针,但可以修改缓冲区的内容。
type
输入视频帧的格式。该参数必须指定为以下值之一:1:I420;2:BGRA;3:NV21;4:RGBA;5:IMC2;7:ARGB;8:NV12;12:iOS 纹理(
CVPixelBufferRef);16:I422。width
视频的宽度,单位为像素。
height
视频的高度,单位为像素。
yStride
对于 YUV 数据,为 Y 缓冲区的每行跨度;对于 RGBA 数据,为总数据长度。
uStride
对于 YUV 数据,为 U 缓冲区的每行跨度;对于 RGBA 数据,该值为 0。
vStride
对于 YUV 数据,为 V 缓冲区的每行跨度;对于 RGBA 数据,该值为 0。
yBuffer
对于 YUV 数据,为 Y 缓冲区的指针;对于 RGBA 数据,为数据缓冲区。
uBuffer
对于 YUV 数据,为 U 缓冲区的指针;对于 RGBA 数据,该值为 0。
vBuffer
对于 YUV 数据,为 V 缓冲区的指针;对于 RGBA 数据,该值为 0。
rotation
视频帧在渲染前的顺时针旋转角度。支持的值包括 0、90、180 和 270 度。
renderTimeMs
视频帧渲染时的 Unix 时间戳(毫秒)。该时间戳可用于指导视频帧的渲染。
avSyncType
预留参数
pixelBuffer
将数据填充到
CVPixelBuffer 中。alphaBuffer
使用人像分割算法输出的 Alpha 通道数据。该数据与视频帧大小一致,每个像素值范围为 [0, 255],其中 0 表示背景,255 表示前景(人像)。通过设置该参数,可以将视频背景渲染为透明、纯色、图像、视频等多种效果。
信息
请确保
alphaBuffer 的大小与视频帧(width × height)完全一致,否则可能导致应用崩溃。alphaStitchMode
当视频帧包含 Alpha 通道数据时,表示
alphaBuffer 与视频帧的相对位置。详见 AgoraAlphaStitchMode。metaInfo
视频帧中的元信息。如需使用该参数,请联系技术支持。
colorSpace
视频帧的色彩空间配置,默认采用 Full Range 和 BT.709 标准。详见
VideoColorSpace。