undefined reference to `img_convert’的解决方法

来源:互联网 发布:医药行业大数据应用 编辑:程序博客网 时间:2024/05/16 00:29

ffmpeg4.0以上版本找不到img_convert,查了一下原因,才知道换成了sws_scale,

所以原来的

img_convert((AVPicture *)pFrameRGB, PIX_FMT_BGR24, (AVPicture*)pFrame,pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height);
 

应该改成:

struct SwsContext *img_convert_ctx;if (img_convert_ctx == NULL){    img_convert_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height,      pCodecCtx->pix_fmt,      pCodecCtx->width, pCodecCtx->height,      PIX_FMT_YUV420P,      sws_flags, NULL, NULL, NULL);    if (img_convert_ctx == NULL)    {         fprintf(stderr, "Cannot initialize the conversion context/n");         exit(1);    }}sws_scale(pthis->img_convert_ctx, pthis->pFrame->data, pthis->pFrame->linesize,     0, pthis->pCodecCtx->height, pthis->pFrameRGB->data, pthis->pFrameRGB->linesize);


 

原创粉丝点击