Browse code

mpc8: add a flush function

Ensures that the next frame decoded after seeking will be decoded as a
keyframe.

Justin Ruggles authored on 2012/08/07 02:06:25
Showing 1 changed files
... ...
@@ -420,6 +420,12 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
420 420
     return c->cur_frame ? c->last_bits_used >> 3 : buf_size;
421 421
 }
422 422
 
423
+static av_cold void mpc8_decode_flush(AVCodecContext *avctx)
424
+{
425
+    MPCContext *c = avctx->priv_data;
426
+    c->cur_frame = 0;
427
+}
428
+
423 429
 AVCodec ff_mpc8_decoder = {
424 430
     .name           = "mpc8",
425 431
     .type           = AVMEDIA_TYPE_AUDIO,
... ...
@@ -427,6 +433,7 @@ AVCodec ff_mpc8_decoder = {
427 427
     .priv_data_size = sizeof(MPCContext),
428 428
     .init           = mpc8_decode_init,
429 429
     .decode         = mpc8_decode_frame,
430
+    .flush          = mpc8_decode_flush,
430 431
     .capabilities   = CODEC_CAP_DR1,
431 432
     .long_name      = NULL_IF_CONFIG_SMALL("Musepack SV8"),
432 433
 };