ffmpeg avcodec_get_frame_defaults已声明已弃用

n2v*_*da2 1 audio ffmpeg function

使ffmpeg变得简单

我参考ffmpeg示例代码(https://github.com/phamquy/FFmpeg-tutorial-samples/blob/master/tutorial03.c)

在视觉工作室12的窗口7中

首先我做了cmd-project,所有链接和complie都没问题

但是当我在vs12中按F5时

1> ConsoleApplication1.cpp(141):错误C4996:'avcodec_get_frame_defaults':声明已弃用Failed | ConsoleApplication1\ConsoleApplication1.vcxproj [Debug | x64]

我怎么了?

我再次下载最新的ffmpeg dll,但注意事项已更改

和谷歌没有告诉我有什么问题,我替换的是什么

我没有想法,如果你知道我使用的功能,请热烈回答

小智 5

关于函数声明的注释avcodec_get_frame_defaults说你应该使用av_frame_unref和代码似乎只是这样做:

void avcodec_get_frame_defaults(AVFrame *frame)
{
#if LIBAVCODEC_VERSION_MAJOR >= 55
     // extended_data should explicitly be freed when needed, this code is unsafe currently
     // also this is not compatible to the <55 ABI/API
    if (frame->extended_data != frame->data && 0)
        av_freep(&frame->extended_data);
#endif

    memset(frame, 0, sizeof(AVFrame));
    av_frame_unref(frame);
}
Run Code Online (Sandbox Code Playgroud)