升级ffmpeg时处理ffmpeg库界面更改 [英] Handling ffmpeg library interface change when upgrading ffmpeg

查看:1878
本文介绍了升级ffmpeg时处理ffmpeg库界面更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

首先,我试图下载并建立对ffmpeg 1.2,当然我有很多警告和错误,关于函数和变量已被弃用或不存在。

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.

为了平滑过渡,我尝试建立对ffmpeg 1.0,最接近的更高版本相对于0.8。我列出了下面列出的警告和错误。

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.

我的问题如下:是否存在任何帮助这些转换的指南,以便在新版本中转换旧的ffmpeg范例/函数调用? strong>由于我们讲的是很多我没有写的代码,我不想逐行分析,如果可能要对旧的函数进行一对一的转换,我会很开心调用新的函数调用,变量相同。

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.

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

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



编辑: strong>


我正在看看这些... _
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

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大部分替代了已弃用的常量。

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

这里可能值得注意的是,av_set_parameters已被弃用并已完全报废,因此您应该在现在调用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!

这篇关于升级ffmpeg时处理ffmpeg库界面更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆