FFMpeg使用vs出现声明被否决解决方案
出现这种问题是因为ffmpeg的新老版本问题
1、将VS的SDL检查关闭
这样虽然解决了问题,但本质没有改变,为以后留下了隐患
2、被声明为已否决详细接口替换方案
’AVStream::codec’: 被声明为已否决:
for (i = 0; i < pFormatCtx->nb_streams; i++)
if (pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
videoindex = i;
break;
}
for (i = 0; i < pFormatCtx->nb_streams; i++)
if (pFormatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
videoindex = i;
break;
}
'AVStream::codec’: 被声明为已否决:
pCodecCtx = pFormatCtx->streams[videoindex]->codec;
pCodecCtx = avcodec_alloc_context3(NULL);
if (pCodecCtx == NULL)
{
printf("Could not allocate AVCodecContext\n");
return -1;
}
**'
avpicture_get_size’: 被声明为已否决:
**
avpicture_get_size(AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height)
av_image_get_buffer_size(AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height,1)
1按1字节对齐,实际大小。4按4字节对齐,实际大小的4倍
’avpicture_fill’: 被声明为已否决:
avpicture_fill((AVPicture *)pFrameYUV, out_buffer, AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height);
av_image_fill_arrays(pFrameYUV->data, pFrameYUV->linesize,out_buffer, AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height,1);
’avcodec_decode_video2’: 被声明为已否决:
ret = avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, packet);
ret = avcodec_send_packet(pCodecCtx, packet);
got_picture = avcodec_receive_frame(pCodecCtx, pFrame);
’av_free_packet’: 被声明为已否决:
av_free_packet(packet);
av_packet_unref(packet);