1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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

This commit is contained in:
Justin Ruggles 2011-10-28 10:07:41 -04:00
parent b03761b130
commit fc43fc9faa

View File

@ -87,6 +87,12 @@ static int gsm_decode_frame(AVCodecContext *avctx, void *data,
return avctx->block_align; return avctx->block_align;
} }
static void gsm_flush(AVCodecContext *avctx)
{
GSMContext *s = avctx->priv_data;
memset(s, 0, sizeof(*s));
}
AVCodec ff_gsm_decoder = { AVCodec ff_gsm_decoder = {
.name = "gsm", .name = "gsm",
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
@ -94,6 +100,7 @@ AVCodec ff_gsm_decoder = {
.priv_data_size = sizeof(GSMContext), .priv_data_size = sizeof(GSMContext),
.init = gsm_init, .init = gsm_init,
.decode = gsm_decode_frame, .decode = gsm_decode_frame,
.flush = gsm_flush,
.long_name = NULL_IF_CONFIG_SMALL("GSM"), .long_name = NULL_IF_CONFIG_SMALL("GSM"),
}; };
@ -104,5 +111,6 @@ AVCodec ff_gsm_ms_decoder = {
.priv_data_size = sizeof(GSMContext), .priv_data_size = sizeof(GSMContext),
.init = gsm_init, .init = gsm_init,
.decode = gsm_decode_frame, .decode = gsm_decode_frame,
.flush = gsm_flush,
.long_name = NULL_IF_CONFIG_SMALL("GSM Microsoft variant"), .long_name = NULL_IF_CONFIG_SMALL("GSM Microsoft variant"),
}; };