如下代码:
if (vctx)
{
if (!rgb)
rgb = new unsigned char[frame->width*frame->height * 4];
uint8_t *data[2] = { 0 };
data[0] = rgb;
int lines[2] = { 0 };
lines[0] = frame->width * 4; //一行的字节数
sws_scale(vctx,
frame->data, //输入数据
frame->linesize, //输入行大小,主要是为了对齐使用
0,
frame->height, //输入高度
data,
lines
);
cout << "sws_scale = " << re << endl;
}