mpegaudio: Refactor mp3on4 flush function

This commit is contained in:
Diego Biurrun 2012-10-22 16:55:23 +02:00
parent 88bdec03b9
commit 2f17f265ed

View File

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