ffmpeg compilation problem: avcodec_find_decoder always returns null

后端 未结 2 1910
执笔经年
执笔经年 2020-12-19 09:13

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

My code works correctly with pre-c

相关标签:
2条回答
  • 2020-12-19 10:05

    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.

    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.

    See http://www.ffmpeg.org/doxygen/trunk/allformats_8c-source.html#l00039 for the source code

    0 讨论(0)
  • 2020-12-19 10:16

    in av_register_all():

    static int initialized;
    if (initialized)  
        return;
    initialized = 1;
    avcodec_register_all();
    

    Maybe due to some unnoticed factors, the static int variable "initialized" has been initialized while the avcodec has not been registered...Then we should call avcodec_register_all() to explicitly fulfill it. But I am inclined to think that it is a bug in ffmpeg.

    0 讨论(0)
提交回复
热议问题