Mercurial > libavformat.hg
comparison flvdec.c @ 4559:ee5d7f52e4bc libavformat
parse aac extradata to fetch channels and sample rate, patch from Netgem
author | bcoudurier |
---|---|
date | Sat, 21 Feb 2009 23:54:50 +0000 |
parents | 241a66d33f49 |
children | d148dbaebaca |
comparison
equal
deleted
inserted
replaced
4558:e95945e51b63 | 4559:ee5d7f52e4bc |
---|---|
21 * | 21 * |
22 * You should have received a copy of the GNU Lesser General Public | 22 * You should have received a copy of the GNU Lesser General Public |
23 * License along with FFmpeg; if not, write to the Free Software | 23 * License along with FFmpeg; if not, write to the Free Software |
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
25 */ | 25 */ |
26 | |
27 #include "libavcodec/mpeg4audio.h" | |
26 #include "avformat.h" | 28 #include "avformat.h" |
27 #include "flv.h" | 29 #include "flv.h" |
28 | 30 |
29 typedef struct { | 31 typedef struct { |
30 int wrong_dts; ///< wrong dts due to negative cts | 32 int wrong_dts; ///< wrong dts due to negative cts |
419 dts = AV_NOPTS_VALUE; | 421 dts = AV_NOPTS_VALUE; |
420 } | 422 } |
421 if (type == 0) { | 423 if (type == 0) { |
422 if ((ret = flv_get_extradata(s, st, size)) < 0) | 424 if ((ret = flv_get_extradata(s, st, size)) < 0) |
423 return ret; | 425 return ret; |
426 if (st->codec->codec_id == CODEC_ID_AAC) { | |
427 MPEG4AudioConfig cfg; | |
428 ff_mpeg4audio_get_config(&cfg, st->codec->extradata, | |
429 st->codec->extradata_size); | |
430 if (cfg.chan_config > 7) | |
431 return -1; | |
432 st->codec->channels = ff_mpeg4audio_channels[cfg.chan_config]; | |
433 st->codec->sample_rate = cfg.sample_rate; | |
434 dprintf(s, "mp4a config channels %d sample rate %d\n", | |
435 st->codec->channels, st->codec->sample_rate); | |
436 } | |
437 | |
424 return AVERROR(EAGAIN); | 438 return AVERROR(EAGAIN); |
425 } | 439 } |
426 } | 440 } |
427 | 441 |
428 ret= av_get_packet(s->pb, pkt, size); | 442 ret= av_get_packet(s->pb, pkt, size); |