Skip to content

Commit

Permalink
mpc8: add a flush function
Browse files Browse the repository at this point in the history
Ensures that the next frame decoded after seeking will be decoded as a
keyframe.
  • Loading branch information
justinruggles committed Aug 6, 2012
1 parent 2fa57c9 commit fdbeae4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libavcodec/mpc8.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,20 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
return c->cur_frame ? c->last_bits_used >> 3 : buf_size;
}

static av_cold void mpc8_decode_flush(AVCodecContext *avctx)
{
MPCContext *c = avctx->priv_data;
c->cur_frame = 0;
}

AVCodec ff_mpc8_decoder = {
.name = "mpc8",
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MUSEPACK8,
.priv_data_size = sizeof(MPCContext),
.init = mpc8_decode_init,
.decode = mpc8_decode_frame,
.flush = mpc8_decode_flush,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Musepack SV8"),
};

0 comments on commit fdbeae4

Please sign in to comment.