[FFmpeg-devel] [PATCH 06/10] libavcodec/ccaption_dec: flush screen buffer on seek

Aman Gupta ffmpeg at tmm1.net
Wed Jan 6 08:41:38 CET 2016


From: Aman Gupta <aman at tmm1.net>

---
 libavcodec/ccaption_dec.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index 424b434..423c576 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -196,6 +196,15 @@ static av_cold int close_decoder(AVCodecContext *avctx)
     return 0;
 }
 
+static void flush_decoder(AVCodecContext *avctx)
+{
+    CCaptionSubContext *ctx = avctx->priv_data;
+    ctx->screen[0].row_used = 0;
+    ctx->screen[1].row_used = 0;
+    av_bprint_clear(&ctx->buffer);
+    ctx->screen_changed = 1;
+}
+
 /**
  * @param ctx closed caption context just to print log
  */
@@ -596,6 +605,7 @@ AVCodec ff_ccaption_decoder = {
     .priv_data_size = sizeof(CCaptionSubContext),
     .init           = init_decoder,
     .close          = close_decoder,
+    .flush          = flush_decoder,
     .decode         = decode,
     .priv_class     = &ccaption_dec_class,
 };
-- 
2.5.3



More information about the ffmpeg-devel mailing list