[FFmpeg-cvslog] mp3on4: create a separate flush function for MP3onMP4.

Justin Ruggles git at videolan.org
Sat Oct 22 01:26:50 CEST 2011


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Sun Sep 25 13:39:04 2011 -0400| [180bf988bc524f4775dd4765f07816df324e808b] | committer: Justin Ruggles

mp3on4: create a separate flush function for MP3onMP4.

The correct decoder private context needs to be used.
This fixes mp3on4 playback and seeking in avplay.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=180bf988bc524f4775dd4765f07816df324e808b
---

 libavcodec/mpegaudiodec.c       |   15 ++++++++++++++-
 libavcodec/mpegaudiodec_float.c |    2 +-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index c3c6ee3..040b109 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -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
diff --git a/libavcodec/mpegaudiodec_float.c b/libavcodec/mpegaudiodec_float.c
index 929d727..7f51250 100644
--- a/libavcodec/mpegaudiodec_float.c
+++ b/libavcodec/mpegaudiodec_float.c
@@ -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



More information about the ffmpeg-cvslog mailing list