# HG changeset patch # User bcoudurier # Date 1235260490 0 # Node ID ee5d7f52e4bc9540730ad6e94be39fb0a840d329 # Parent e95945e51b63fedb621c1a0e8ce6f9130a109db8 parse aac extradata to fetch channels and sample rate, patch from Netgem diff -r e95945e51b63 -r ee5d7f52e4bc flvdec.c --- a/flvdec.c Sat Feb 21 23:00:07 2009 +0000 +++ b/flvdec.c Sat Feb 21 23:54:50 2009 +0000 @@ -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 @@ 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); } }