]> git.sesse.net Git - ffmpeg/commitdiff
mp3on4: create a separate flush function for MP3onMP4.
authorJustin Ruggles <justin.ruggles@gmail.com>
Sun, 25 Sep 2011 17:39:04 +0000 (13:39 -0400)
committerJustin Ruggles <justin.ruggles@gmail.com>
Fri, 21 Oct 2011 16:33:15 +0000 (12:33 -0400)
The correct decoder private context needs to be used.
This fixes mp3on4 playback and seeking in avplay.

libavcodec/mpegaudiodec.c
libavcodec/mpegaudiodec_float.c

index c3c6ee38059c316357ce4e9414b824ee078e1734..040b1090d6d1cec3c77174041796f20d55e1f257 100644 (file)
@@ -2004,6 +2004,19 @@ alloc_fail:
 }
 
 
+static void flush_mp3on4(AVCodecContext *avctx)
+{
+    int i;
+    MP3On4DecodeContext *s = avctx->priv_data;
+
+    for (i = 0; i < s->frames; i++) {
+        MPADecodeContext *m = s->mp3decctx[i];
+        memset(m->synth_buf, 0, sizeof(m->synth_buf));
+        m->last_buf_size = 0;
+    }
+}
+
+
 static int decode_frame_mp3on4(AVCodecContext * avctx,
                         void *data, int *data_size,
                         AVPacket *avpkt)
@@ -2148,7 +2161,7 @@ AVCodec ff_mp3on4_decoder = {
     .init           = decode_init_mp3on4,
     .close          = decode_close_mp3on4,
     .decode         = decode_frame_mp3on4,
-    .flush          = flush,
+    .flush          = flush_mp3on4,
     .long_name      = NULL_IF_CONFIG_SMALL("MP3onMP4"),
 };
 #endif
index 929d72738b6a8d3af589b91dd45aafd55ab2ac3e..7f512500b3a06d84f42f66af638ea5021bdd0e35 100644 (file)
@@ -83,7 +83,7 @@ AVCodec ff_mp3on4float_decoder = {
     .init           = decode_init_mp3on4,
     .close          = decode_close_mp3on4,
     .decode         = decode_frame_mp3on4,
-    .flush          = flush,
+    .flush          = flush_mp3on4,
     .long_name      = NULL_IF_CONFIG_SMALL("MP3onMP4"),
 };
 #endif