]> git.sesse.net Git - ffmpeg/commitdiff
mpegaudio: Refactor mp3on4 flush function
authorDiego Biurrun <diego@biurrun.de>
Mon, 22 Oct 2012 14:55:23 +0000 (16:55 +0200)
committerDiego Biurrun <diego@biurrun.de>
Tue, 23 Oct 2012 08:52:25 +0000 (10:52 +0200)
libavcodec/mpegaudiodec.c

index 80acdadc4844acfe3ce221eccc751473e98e4151..9c5ef265c1b0732421e47fa8df3b2af5bbac6bd7 100644 (file)
@@ -1681,11 +1681,15 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr,
     return buf_size;
 }
 
+static void mp_flush(MPADecodeContext *ctx)
+{
+    memset(ctx->synth_buf, 0, sizeof(ctx->synth_buf));
+    ctx->last_buf_size = 0;
+}
+
 static void flush(AVCodecContext *avctx)
 {
-    MPADecodeContext *s = avctx->priv_data;
-    memset(s->synth_buf, 0, sizeof(s->synth_buf));
-    s->last_buf_size = 0;
+    mp_flush(avctx->priv_data);
 }
 
 #if CONFIG_MP3ADU_DECODER || CONFIG_MP3ADUFLOAT_DECODER
@@ -1875,11 +1879,8 @@ 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;
-    }
+    for (i = 0; i < s->frames; i++)
+        mp_flush(s->mp3decctx[i]);
 }