VideoFrame
视频帧的属性设置。
C++
struct VideoFrame {
VideoFrame():
type(VIDEO_PIXEL_DEFAULT),
width(0),
height(0),
yStride(0),
uStride(0),
vStride(0),
yBuffer(NULL),
uBuffer(NULL),
vBuffer(NULL),
rotation(0),
renderTimeMs(0),
avsync_type(0),
metadata_buffer(NULL),
metadata_size(0),
sharedContext(0),
textureId(0),
pixelBuffer(NULL){
memset(matrix, 0, sizeof(matrix));
}
VIDEO_PIXEL_FORMAT type;
int width;
int height;
int yStride;
int uStride;
int vStride;
uint8_t* yBuffer;
uint8_t* uBuffer;
uint8_t* vBuffer;
int rotation;
int64_t renderTimeMs;
int avsync_type;
uint8_t* metadata_buffer;
int metadata_size;
void* sharedContext;
int textureId;
float matrix[16];
void* pixelBuffer;
};
缓冲区给出的是指向指针的指针,该接口不能修改缓冲区的指针,只能修改缓冲区的内容。
type
像素格式。详见 VIDEO_PIXEL_FORMAT
。
width
视频像素宽度。
height
视频像素高度。
yStride
对 YUV 数据,表示 Y 缓冲区的行跨度;对 RGBA 数据,表示总的数据长度。
uStride
对 YUV 数据,表示 U 缓冲区的行跨度;对 RGBA 数据,值为 0。
vStride
对 YUV 数据,表示 V 缓冲区的行跨度;对 RGBA 数据,值为 0。
yBuffer
对 YUV 数据,表示 Y 缓冲区的指针;对 RGBA 数据,表示数据缓冲区。
uBuffer
对 YUV 数据,表示 U 缓冲区的指针;对 RGBA 数据,值为空。
vBuffer
对 YUV 数据,表示 V 缓冲区的指针;对 RGBA 数据,值为空。
rotation
在渲染视频前设置该帧的顺时针旋转角度,目前支持 0 度、90 度、180 度,和 270 度。
renderTimeMs
视频帧被渲染时的 Unix 时间戳(毫秒)。该时间戳可用于指导渲染视频帧。该参数为必填。
avsync_type
保留参数。
metadata_buffer
该参数仅适用于 Texture 格式的视频数据。指 MetaData 的数据缓冲区,默认值为 NULL
。
metadata_size
该参数仅适用于 Texture 格式的视频数据。指 MetaData 的大小,默认值为 0
。
textureId
该参数仅适用于 Texture 格式的视频数据。Texture ID。
matrix
该参数仅适用于 Texture 格式的视频数据。为一个输入的 4x4 变换矩阵,典型值为一个单位矩阵。