100行代码实现最简单的基于FFMPEG+SDL的视频播放器(SDL1.x)

时间:2022-03-31 12:02:59

转载地址:http://blog.csdn.net/leixiaohua1020/article/details/8652605

基于linux下编译leixiaohua的程序,出现以下的错误

gcc simplest_ffmpeg_player.c -g -o smp.out -I/usr/local/include -L/usr/local/lib -lSDLmain -lSDL -lavformat -lavcodec -lavutil -lswscale
simplest_ffmpeg_player.c: In function ‘main’:
simplest_ffmpeg_player.c:64: warning: ‘avcodec_alloc_frame’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3545)
simplest_ffmpeg_player.c:65: warning: ‘avcodec_alloc_frame’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3545)
/tmp/ccZCLi0J.o: In function `main':
/home/mlf/ffmpeg/project/simplest_demo/simplest_ffmpeg_player.c:34: undefined reference to `av_find_stream_info'
collect2: ld returned 1 exit status
产生错误的原因是ffmpeg使用的函数发生了改变,deprecate(不支持)avcodec_alloc_frame和av_find_stream_info函数。

我参考doc/APIchanges,修改了对应的函数。发现成功。