diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2008-04-26 14:18:29 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2008-04-26 14:18:29 +0000 |
commit | 9f95bfe2b9c8dedf8d99637af05161cbd33d6acd (patch) | |
tree | a72401999464775706dae68c27610ec922d08401 /libavcodec/mpegaudiodec.c | |
parent | f0f53c83baf5adfd98404bcd689dec6c5a9789f7 (diff) | |
download | ffmpeg-9f95bfe2b9c8dedf8d99637af05161cbd33d6acd.tar.gz |
correctly patch syncword for samples rates < 16000, decoder now fully support all iso ref files
Originally committed as revision 12992 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r-- | libavcodec/mpegaudiodec.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index 5e9ec6a626..bf797bdaac 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -62,6 +62,7 @@ typedef struct MP3On4DecodeContext { int frames; ///< number of mp3 frames per block (number of mp3 decoder instances) int chan_cfg; ///< channel config number + int syncword; ///< syncword patch MPADecodeContext *mp3decctx[5]; ///< MPADecodeContext for every decoder instance } MP3On4DecodeContext; @@ -2513,6 +2514,11 @@ static int decode_init_mp3on4(AVCodecContext * avctx) s->frames = mp3Frames[s->chan_cfg]; avctx->channels = ff_mpeg4audio_channels[s->chan_cfg]; + if (cfg.sample_rate < 16000) + s->syncword = 0xffe00000; + else + s->syncword = 0xfff00000; + /* Init the first mp3 decoder in standard way, so that all tables get builded * We replace avctx->priv_data with the context of the first decoder so that * decode_init() does not have to be changed. @@ -2586,8 +2592,7 @@ static int decode_frame_mp3on4(AVCodecContext * avctx, m = s->mp3decctx[fr]; assert (m != NULL); - // Get header - header = AV_RB32(buf) | 0xfff00000; + header = (AV_RB32(buf) & 0x000fffff) | s->syncword; // patch header if (ff_mpa_check_header(header) < 0) { // Bad header, discard block *data_size = 0; |