[FFmpeg-cvslog] libgsm: add flush function to reset the decoder state when seeking

Justin Ruggles git at videolan.org
Thu Nov 3 02:23:11 CET 2011


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Fri Oct 28 10:35:15 2011 -0400| [20e081dddcffa6eec459d695f3850796d1bdd7f7] | committer: Justin Ruggles

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=20e081dddcffa6eec459d695f3850796d1bdd7f7
---

 libavcodec/libgsm.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c
index bca7bfb..c02594d 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"),
 };



More information about the ffmpeg-cvslog mailing list