Ffmpeg中对于相应的音频格式,只要配置了正确的protocol、demuxer、decoder、parser、filters就可以正确解码了。
其中:
(1)、Protocol:
Ffmpeg中包含的protocol在protocol_list.c中,目前我们用到的ffmpeg protocol有:file、http、mmst。
File: 对于本地音乐采用file协议读取数据;(file.c)
http:对于网络http://... 音乐采用http协议读取数据;(http.c)
mmst: 对于电台 mms://... 音乐采用mmst协议读取数据;(mmst.c)
(2)、demuxer: 解复用器
AVFormatContext中存储 AVInputFormat(变量iformat)即为相应的demuxer.
ffmpeg的demuxer存储在AVFormatContext的iformat中,在eclipse中debug模式运行ffmpeg,当运行到avformat_open_input ()函数的 init_input()函数,就可以获得iformat参数了,即可以得到demuxer。如运行音乐“xhs.ogg”音乐,运行到此时,s->iformat为ff_ogg_demuxer,由此可确认”xhs.ogg”音乐的demuxer为ff_ogg_demuxer。
具体在init_input()函数中的av_probe_input_format2()-》av_probe_input_format3()-》av_iformat_next()获得demuxer.
(3)、Decoder: 解码器
Decoder最直接是在ubuntu中使用ffplay播放该音乐,从ffplay的默认打印信息中就可以得知其使用的