ffmpeg编译问题:avcodec_find_decoder始终返回null [英] ffmpeg compilation problem: avcodec_find_decoder always returns null

查看:609
本文介绍了ffmpeg编译问题:avcodec_find_decoder始终返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近尝试通过从源代码下载和编译ffmpeg来升级在Mac OS X应用程序中使用的ffmpeg库.

I recently tried to upgrade the ffmpeg libraries I use in my Mac OS X application by downloading and compiling ffmpeg from source.

我的代码可以与Windows上相同版本的预编译库一起正常工作. 在Mac OS X上,该库似乎可以工作(它可以打开文件并找到使用的流和编解码器),但是当它到达avcodec_find_decoder时,此函数始终返回null.

My code works correctly with pre-compiled libraries of the same version on windows. On Mac OS X, the library appears to work (it can open the file and find the streams and codecs used), but when it gets to avcodec_find_decoder, this function always returns null.

该代码已与该库的旧版本一起使用(一年前在Mac OS X 10.5上编译)

The code has worked with an older version of the library (compiled a year ago on Mac OS X 10.5)

我使用以下命令配置了fmpeg

I configured fmpeg using

./configure --extra-cflags="-arch i386" --extra-ldflags='-arch i386' --arch=x86_32 --target-os=darwin --enable-cross-compile --disable-indev=jack --enable-shared --disable-static

我检查了config.mak,它似乎为我尝试启用的文件类型启用了解码器(ogg,vorbis,avi,mkv等) 我还检查了是否使用了正确的头文件以及是否使用了新编译的库.

I checked config.mak, and it appears to have the decoders for the file types I tried enabled (ogg, vorbis, avi, mkv, ...) I also checked that the correct header files have been used and that the newly compiled library is used.

我只发现了一些与此问题相关的旧帖子,但没有任何解决方案:

I have found only some older posts relating to this issue, but without any solution:

http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2007-January/021399.html

http://libav-users. 943685.n4.nabble.com/avcodec-find-decoder-problem-td944800.html

进一步检查,看来av_codec_next(NULL)也返回null,这意味着没有可用的单个编解码器,或者未设置utils.c中的first_avcodec(我实际上根本找不到设置了此变量后,我会假设使用了av_register_all,但在那儿找不到它)

checking further, it appears av_codec_next(NULL) returns null as well, which means there isn't a single codec available, or that first_avcodec in utils.c is not set (I actually haven't found at all where this variable is set, I would have assumed av_register_all, but I can't find it there)

推荐答案

尽管有人仍然可以帮助我解释我的问题,但我仍然很想解决我的问题.

I've found a solution for my problem, even though I would still be interested if anyone can help me with an explanation of my problem.

基本上,我只在函数顶部调用av_register_all(). 现在,在此之后添加avcodec_register_all()时,我的代码又可以工作了. 我不明白为什么会这样,因为从查看源代码开始,av_register_all()应该调用avcodec_register_all().

Basically, I was calling only av_register_all() at the top of my function. Now when adding avcodec_register_all() after this, my code works again. I don't understand why though, because avcodec_register_all() should be called by av_register_all() from looking at the source code.

请参见 http://www.ffmpeg.org/doxygen/trunk /allformats_8c-source.html#l00039 获取源代码

这篇关于ffmpeg编译问题:avcodec_find_decoder始终返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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