在升级ffmpeg时处理ffmpeg库接口更改(Handling ffmpeg library interface change when upgrading ffmpeg)

编程入门 行业动态 更新时间:2024-10-04 17:21:34
在升级ffmpeg时处理ffmpeg库接口更改(Handling ffmpeg library interface change when upgrading ffmpeg)

我们正在尝试升级我们的程序使用的ffmpeg版本。 跳跃很大,因为我们目前使用的是ffmpeg 0.8,最新版本是1.2。

在这些测试中,我使用(让我说​​)我在这里找到的惊人的软件包。

作为第一件事,我试图下载和构建反对ffmpeg 1.2,当然我得到了很多警告和错误,关于函数和变量已被弃用或不再存在。

为了平滑过渡,我试图在ffmpeg 1.0的基础上构建,这是0.8的最高版本。 我列出了下面列出的警告和错误列表。

我的问题如下: 它是否存在任何指导来帮助这些转换,在新版本中转换旧的ffmpeg范例/函数调用? 由于我们谈论了很多我没有写的代码,并且我不想逐行分析,所以如果可能将旧函数调用一对一转换为新的函数调用,对变量也一样。

以下是警告和错误列表(我清除了它,因此每个错误/警告只有一个条目)

warning: 'AVStream* av_new_stream(AVFormatContext*, int)' is deprecated (declared at /ffmpeg/include/libavformat/avformat.h:1646) [-Wdeprecated-declarations] warning: 'int avcodec_open(AVCodecContext*, AVCodec*)' is deprecated (declared at /ffmpeg/include/libavcodec/avcodec.h:3569) [-Wdeprecated-declarations] error: 'avcodec_init' was not declared in this scope warning: 'int avcodec_encode_video(AVCodecContext*, uint8_t*, int, const AVFrame*)' is deprecated (declared at /ffmpeg/include/libavcodec/avcodec.h:4272) [-Wdeprecated-declarations] warning: 'AVCodecContext* avcodec_alloc_context()' is deprecated (declared at /ffmpeg/include/libavcodec/avcodec.h:3423) [-Wdeprecated-declarations] warning: 'int avcodec_decode_audio3(AVCodecContext*, int16_t*, int*, AVPacket*)' is deprecated (declared at /ffmpeg/include/libavcodec/avcodec.h:3852) [-Wdeprecated-declarations] warning: 'void av_close_input_file(AVFormatContext*)' is deprecated (declared at /ffmpeg/include/libavformat/avformat.h:1622) [-Wdeprecated-declarations] error: 'av_open_input_file' was not declared in this scope warning: 'int av_find_stream_info(AVFormatContext*)' is deprecated (declared at /ffmpeg/include/libavformat/avformat.h:1446) [-Wdeprecated-declarations] error: 'av_set_parameters' was not declared in this scope error: 'AVFormatContext' has no member named 'file_size' error: 'URL_WRONLY' was not declared in this scope error: 'url_fopen' was not declared in this scope error: 'url_fclose' was not declared in this scope error: 'SAMPLE_FMT_U8' was not declared in this scope error: 'SAMPLE_FMT_S16' was not declared in this scope error: 'SAMPLE_FMT_S32' was not declared in this scope error: 'SAMPLE_FMT_FLT' was not declared in this scope error: 'FF_I_TYPE' was not declared in this scope

编辑:

我正在看这些... http://ffmpeg.org/doxygen/0.8/deprecated.html http://ffmpeg.org/doxygen/0.9/deprecated.html http://ffmpeg.org/doxygen/1.0/deprecated.html http://ffmpeg.org/doxygen/1.1/deprecated.html http://ffmpeg.org/doxygen/1.2/deprecated.html http://ffmpeg.org/doxygen/trunk/deprecated.html

We are currently trying to upgrade the ffmpeg version that our program uses. The jump is big because what we have used so far is ffmpeg 0.8, and latest version is 1.2.

In these tests I am using the (let me say) amazing packages I find here.

As first thing, I tried to download and build against ffmpeg 1.2, and of course I got a lot of warnings and errors, about function and variables deprecated or not existing any more.

To smooth the transition, I tried then to build against ffmpeg 1.0, the closest higher version with respect to 0.8. I got a list of warnings and errors that I list here below.

My question is the following: Does it exist any guide to help in these transition, to convert old ffmpeg paradigms/functions calls in the new version? Since we are speaking about a lot of code that I did not write and that I would like not to analyse line by line, I would be very happy if it would be possibly to do a one-to-one conversion of old functions calls to new functions calls, same for variables.

Here is the list of warnings and errors (I have cleaned it so there is only one entry per error/warning)

warning: 'AVStream* av_new_stream(AVFormatContext*, int)' is deprecated (declared at /ffmpeg/include/libavformat/avformat.h:1646) [-Wdeprecated-declarations] warning: 'int avcodec_open(AVCodecContext*, AVCodec*)' is deprecated (declared at /ffmpeg/include/libavcodec/avcodec.h:3569) [-Wdeprecated-declarations] error: 'avcodec_init' was not declared in this scope warning: 'int avcodec_encode_video(AVCodecContext*, uint8_t*, int, const AVFrame*)' is deprecated (declared at /ffmpeg/include/libavcodec/avcodec.h:4272) [-Wdeprecated-declarations] warning: 'AVCodecContext* avcodec_alloc_context()' is deprecated (declared at /ffmpeg/include/libavcodec/avcodec.h:3423) [-Wdeprecated-declarations] warning: 'int avcodec_decode_audio3(AVCodecContext*, int16_t*, int*, AVPacket*)' is deprecated (declared at /ffmpeg/include/libavcodec/avcodec.h:3852) [-Wdeprecated-declarations] warning: 'void av_close_input_file(AVFormatContext*)' is deprecated (declared at /ffmpeg/include/libavformat/avformat.h:1622) [-Wdeprecated-declarations] error: 'av_open_input_file' was not declared in this scope warning: 'int av_find_stream_info(AVFormatContext*)' is deprecated (declared at /ffmpeg/include/libavformat/avformat.h:1446) [-Wdeprecated-declarations] error: 'av_set_parameters' was not declared in this scope error: 'AVFormatContext' has no member named 'file_size' error: 'URL_WRONLY' was not declared in this scope error: 'url_fopen' was not declared in this scope error: 'url_fclose' was not declared in this scope error: 'SAMPLE_FMT_U8' was not declared in this scope error: 'SAMPLE_FMT_S16' was not declared in this scope error: 'SAMPLE_FMT_S32' was not declared in this scope error: 'SAMPLE_FMT_FLT' was not declared in this scope error: 'FF_I_TYPE' was not declared in this scope

Edit:

I am taking a look at these... http://ffmpeg.org/doxygen/0.8/deprecated.html http://ffmpeg.org/doxygen/0.9/deprecated.html http://ffmpeg.org/doxygen/1.0/deprecated.html http://ffmpeg.org/doxygen/1.1/deprecated.html http://ffmpeg.org/doxygen/1.2/deprecated.html http://ffmpeg.org/doxygen/trunk/deprecated.html

最满意答案

正如Gabi所指出的那样,该URL具有大多数已弃用常量的替代品。

但是,它缺少其中的一部分,因此我会发布输出所指示的所有更改以完成此编译步骤:

avcodec_init -> avcodec_register_all av_open_input_file -> avformat_open_input

在这里可能值得注意的是,av_set_parameters已被弃用并被完全废弃,所以现在应该在对avformat_open_input的调用中指定参数。

AVFormatContext.file_size -> avio_size() URL_WRONLY -> AVIO_FLAG_WRITE url_fopen -> avio_open url_fclose -> avio_close SAMPLE_FMT_U8 -> AV_SAMPLE_FMT_U8 SAMPLE_FMT_S16 -> AV_SAMPLE_FMT_S16 SAMPLE_FMT_S32 -> AV_SAMPLE_FMT_S32 SAMPLE_FMT_FLT -> AV_SAMPLE_FMT_FLT FF_I_TYPE -> AV_PICTURE_TYPE_I

这应该涵盖所有的实际错误。 如果只是一个警告,那么花点时间找出他们正在进行的步骤!

As Gabi points out, that URL has most of the replacements of the deprecated constants.

However, it lacks a few of them, so I'll post all the changes that your output indicates are necessary to get through this compilation step:

avcodec_init -> avcodec_register_all av_open_input_file -> avformat_open_input

It's probably worth noting here that av_set_parameters was deprecated and completely scrapped, so you should specify parameters in the call to avformat_open_input now.

AVFormatContext.file_size -> avio_size() URL_WRONLY -> AVIO_FLAG_WRITE url_fopen -> avio_open url_fclose -> avio_close SAMPLE_FMT_U8 -> AV_SAMPLE_FMT_U8 SAMPLE_FMT_S16 -> AV_SAMPLE_FMT_S16 SAMPLE_FMT_S32 -> AV_SAMPLE_FMT_S32 SAMPLE_FMT_FLT -> AV_SAMPLE_FMT_FLT FF_I_TYPE -> AV_PICTURE_TYPE_I

That should cover all of your actual errors. If there's just a warning, then take some time to figure out what they're phasing in!

更多推荐

本文发布于:2023-08-04 21:13:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1422214.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:接口   Handling   ffmpeg   library   upgrading

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!