AgoraVideoFrame
- macOS
更新时间不可用
外部视频帧。
__attribute__((visibility("default"))) @interface AgoraVideoFrame : NSObject
@property(assign, nonatomic) NSInteger format;
@property(assign, nonatomic) CMTime time;
@property(assign, nonatomic) int stride DEPRECATED_MSG_ATTRIBUTE("use strideInPixels instead");
@property(assign, nonatomic) int strideInPixels;
@property(assign, nonatomic) int height;
@property(assign, nonatomic) CVPixelBufferRef _Nullable textureBuf;
@property(strong, nonatomic) IMAGE_CLASS * _Nullable image;
@property(strong, nonatomic) NSData *_Nullable dataBuf;
@property(strong, nonatomic) NSData *_Nullable alphaBuf;
@property(assign, nonatomic) AgoraAlphaStitchMode alphaStitchMode;
@property(assign, nonatomic) int cropLeft;
@property(assign, nonatomic) int cropTop;
@property(assign, nonatomic) int cropRight;
@property(assign, nonatomic) int cropBottom;
@property(assign, nonatomic) int rotation;
@property(strong, nonatomic) AgoraColorSpace *_Nullable colorSpace;
@end注:
strideInPixels:步幅单位为像素,而非字节。- 关于帧的宽度和高度:未定义
width字段,但可以通过以下方式推导:
croppedWidth = (strideInPixels - cropLeft - cropRight)``croppedHeight = (height - cropTop - cropBottom)
- 关于裁剪:如果缓冲区包含无效数据,可以通过裁剪去除。例如,帧大小为 360 x 640,缓冲区步幅为 368,即右侧多出 8 像素用于填充,此时可以设置:
strideInPixels = 368;``height = 640;``cropRight = 8;``// cropLeft、cropTop、cropBottom 默认为 0。
属性
| 参数名 | 描述 |
|---|---|
format | |
time | |
stride | |
strideInPixels | |
height | |
textureBuf | |
image | |
dataBuf | |
alphaBuf | |
alphaStitchMode | Alpha 通道拼接模式,表示 |
cropLeft | |
cropTop | |
cropRight | |
cropBottom | |
rotation | |
colorSpace | 视频帧的色彩空间配置。默认采用 Full Range 和 BT.709 标准。详见 |