diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2009-02-21 23:54:50 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2009-02-21 23:54:50 +0000 |
commit | d2718187b9302e022666a8f3e3c21e78f09d9bae (patch) | |
tree | 24e0de3ccb743ada9fec8ef00a178c9d770ce113 | |
parent | c132938d52cf8a60bb676f54812a77d2e131eca4 (diff) | |
download | ffmpeg-d2718187b9302e022666a8f3e3c21e78f09d9bae.tar.gz |
parse aac extradata to fetch channels and sample rate, patch from Netgem
Originally committed as revision 17506 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/flvdec.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 06ae33aaec..c925e54539 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -23,6 +23,8 @@ * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include "libavcodec/mpeg4audio.h" #include "avformat.h" #include "flv.h" @@ -421,6 +423,18 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) if (type == 0) { if ((ret = flv_get_extradata(s, st, size)) < 0) return ret; + if (st->codec->codec_id == CODEC_ID_AAC) { + MPEG4AudioConfig cfg; + ff_mpeg4audio_get_config(&cfg, st->codec->extradata, + st->codec->extradata_size); + if (cfg.chan_config > 7) + return -1; + st->codec->channels = ff_mpeg4audio_channels[cfg.chan_config]; + st->codec->sample_rate = cfg.sample_rate; + dprintf(s, "mp4a config channels %d sample rate %d\n", + st->codec->channels, st->codec->sample_rate); + } + return AVERROR(EAGAIN); } } |