aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/libgsm.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-10-28 10:35:15 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-11-02 14:41:17 -0400
commit20e081dddcffa6eec459d695f3850796d1bdd7f7 (patch)
tree95d41e55afb9b7dc08d84b47a41015f4bf48bcdc /libavcodec/libgsm.c
parent480324e7ca0b87105fd7ee168292a0d5692af128 (diff)
downloadffmpeg-20e081dddcffa6eec459d695f3850796d1bdd7f7.tar.gz
libgsm: add flush function to reset the decoder state when seeking
Diffstat (limited to 'libavcodec/libgsm.c')
-rw-r--r--libavcodec/libgsm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c
index bca7bfbe97..c02594d0d6 100644
--- a/libavcodec/libgsm.c
+++ b/libavcodec/libgsm.c
@@ -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"),
};