[FFmpeg-cvslog] lavc/options: add ass_ro_flush_noop to flags2

Clément Bœsch git at videolan.org
Fri Feb 26 22:01:51 CET 2016


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sat Feb 20 21:27:45 2016 +0100| [30e76853608f150450fac2497179159a6d556e12] | committer: Clément Bœsch

lavc/options: add ass_ro_flush_noop to flags2

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

 doc/APIchanges                   |    6 ++++++
 libavcodec/ass.c                 |    3 ++-
 libavcodec/avcodec.h             |    4 ++++
 libavcodec/ccaption_dec.c        |    3 ++-
 libavcodec/libzvbi-teletextdec.c |    3 ++-
 libavcodec/movtextdec.c          |    3 ++-
 libavcodec/options_table.h       |    1 +
 libavcodec/samidec.c             |    3 ++-
 libavcodec/textdec.c             |    3 ++-
 libavcodec/version.h             |    2 +-
 10 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index a703490..a808e9e 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,12 @@ libavutil:     2015-08-28
 
 API changes, most recent first:
 
+2016-xx-xx - xxxxxxx - lavc 57.27.100 - avcodec.h
+  "flags2" decoding option now allows the flag "ass_ro_flush_noop" preventing
+  the reset of the ASS ReadOrder field on flush. This affects the content of
+  AVSubtitles.rects[N]->ass when "sub_text_format" is set to "ass" (see
+  previous entry).
+
 2016-xx-xx - xxxxxxx - lavc 57.26.100 - avcodec.h
   Add a "sub_text_format" subtitles decoding option allowing the values "ass"
   (recommended) and "ass_with_timings" (not recommended, deprecated, default).
diff --git a/libavcodec/ass.c b/libavcodec/ass.c
index da0ee18..b4f081c 100644
--- a/libavcodec/ass.c
+++ b/libavcodec/ass.c
@@ -124,7 +124,8 @@ int ff_ass_add_rect(AVSubtitle *sub, const char *dialog,
 void ff_ass_decoder_flush(AVCodecContext *avctx)
 {
     FFASSDecoderContext *s = avctx->priv_data;
-    s->readorder = 0;
+    if (!(avctx->flags2 & AV_CODEC_FLAG2_RO_FLUSH_NOOP))
+        s->readorder = 0;
 }
 
 void ff_ass_bprint_text_event(AVBPrint *buf, const char *p, int size,
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index d3e035a..695ca05 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -835,6 +835,10 @@ typedef struct RcOverride{
  * Do not skip samples and export skip information as frame side data
  */
 #define AV_CODEC_FLAG2_SKIP_MANUAL    (1 << 29)
+/**
+ * Do not reset ASS ReadOrder field on flush (subtitles decoding)
+ */
+#define AV_CODEC_FLAG2_RO_FLUSH_NOOP  (1 << 30)
 
 /* Unsupported options :
  *              Syntax Arithmetic coding (SAC)
diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index 44c3b98..d3f32dd 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -307,7 +307,8 @@ static void flush_decoder(AVCodecContext *avctx)
     ctx->last_real_time = 0;
     ctx->screen_touched = 0;
     ctx->buffer_changed = 0;
-    ctx->readorder = 0;
+    if (!(avctx->flags2 & AV_CODEC_FLAG2_RO_FLUSH_NOOP))
+        ctx->readorder = 0;
     av_bprint_clear(&ctx->buffer);
 }
 
diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c
index 8b031fa..a81f924 100644
--- a/libavcodec/libzvbi-teletextdec.c
+++ b/libavcodec/libzvbi-teletextdec.c
@@ -528,7 +528,8 @@ static int teletext_close_decoder(AVCodecContext *avctx)
     vbi_decoder_delete(ctx->vbi);
     ctx->vbi = NULL;
     ctx->pts = AV_NOPTS_VALUE;
-    ctx->readorder = 0;
+    if (!(avctx->flags2 & AV_CODEC_FLAG2_RO_FLUSH_NOOP))
+        ctx->readorder = 0;
     return 0;
 }
 
diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
index fa70497..abf8711 100644
--- a/libavcodec/movtextdec.c
+++ b/libavcodec/movtextdec.c
@@ -518,7 +518,8 @@ static int mov_text_decode_close(AVCodecContext *avctx)
 static void mov_text_flush(AVCodecContext *avctx)
 {
     MovTextContext *m = avctx->priv_data;
-    m->readorder = 0;
+    if (!(avctx->flags2 & AV_CODEC_FLAG2_RO_FLUSH_NOOP))
+        m->readorder = 0;
 }
 
 AVCodec ff_movtext_decoder = {
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index b493dd1..1a02862 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -90,6 +90,7 @@ static const AVOption avcodec_options[] = {
 {"showall", "Show all frames before the first keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, V|D, "flags2"},
 {"export_mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, "flags2"},
 {"skip_manual", "do not skip samples and export skip information as frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SKIP_MANUAL}, INT_MIN, INT_MAX, V|D, "flags2"},
+{"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, INT_MAX, S|D, "flags2"},
 #if FF_API_MOTION_EST
 {"me_method", "set motion estimation method", OFFSET(me_method), AV_OPT_TYPE_INT, {.i64 = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method"},
 {"zero", "zero motion estimation (fastest)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ZERO }, INT_MIN, INT_MAX, V|E, "me_method" },
diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c
index 2874e21..16f3f58 100644
--- a/libavcodec/samidec.c
+++ b/libavcodec/samidec.c
@@ -166,7 +166,8 @@ static av_cold int sami_close(AVCodecContext *avctx)
 static void sami_flush(AVCodecContext *avctx)
 {
     SAMIContext *sami = avctx->priv_data;
-    sami->readorder = 0;
+    if (!(avctx->flags2 & AV_CODEC_FLAG2_RO_FLUSH_NOOP))
+        sami->readorder = 0;
 }
 
 AVCodec ff_sami_decoder = {
diff --git a/libavcodec/textdec.c b/libavcodec/textdec.c
index 4e2ff2c..964da72 100644
--- a/libavcodec/textdec.c
+++ b/libavcodec/textdec.c
@@ -66,7 +66,8 @@ static int text_decode_frame(AVCodecContext *avctx, void *data,
 static void text_flush(AVCodecContext *avctx)
 {
     TextContext *text = avctx->priv_data;
-    text->readorder = 0;
+    if (!(avctx->flags2 & AV_CODEC_FLAG2_RO_FLUSH_NOOP))
+        text->readorder = 0;
 }
 
 #define DECLARE_CLASS(decname) static const AVClass decname ## _decoder_class = {   \
diff --git a/libavcodec/version.h b/libavcodec/version.h
index fc5d8bf..decc4a4 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  57
-#define LIBAVCODEC_VERSION_MINOR  26
+#define LIBAVCODEC_VERSION_MINOR  27
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \



More information about the ffmpeg-cvslog mailing list