libgsm: add flush function to reset the decoder state when seeking

This commit is contained in:
Justin Ruggles 2011-10-28 10:35:15 -04:00
parent 480324e7ca
commit 20e081dddc
1 changed files with 7 additions and 0 deletions

View File

@ -194,6 +194,11 @@ static int libgsm_decode_frame(AVCodecContext *avctx,
return avctx->block_align;
}
static void libgsm_flush(AVCodecContext *avctx) {
gsm_destroy(avctx->priv_data);
avctx->priv_data = gsm_create();
}
AVCodec ff_libgsm_decoder = {
.name = "libgsm",
.type = AVMEDIA_TYPE_AUDIO,
@ -201,6 +206,7 @@ AVCodec ff_libgsm_decoder = {
.init = libgsm_decode_init,
.close = libgsm_decode_close,
.decode = libgsm_decode_frame,
.flush = libgsm_flush,
.long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"),
};
@ -211,5 +217,6 @@ AVCodec ff_libgsm_ms_decoder = {
.init = libgsm_decode_init,
.close = libgsm_decode_close,
.decode = libgsm_decode_frame,
.flush = libgsm_flush,
.long_name = NULL_IF_CONFIG_SMALL("libgsm GSM Microsoft variant"),
};