[FFmpeg-devel] [PATCH 3/6] lavc/options: add ass_ro_flush_noop to flags2
Clément Bœsch
u at pkh.me
Sun Feb 21 13:08:30 CET 2016
---
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 | 4 ++--
9 files changed, 19 insertions(+), 8 deletions(-)
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 de463ff..5ff52f3 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -836,6 +836,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 99ba2e7..52b8f2a 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,8 +29,8 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
-#define LIBAVCODEC_VERSION_MINOR 24
-#define LIBAVCODEC_VERSION_MICRO 105
+#define LIBAVCODEC_VERSION_MINOR 25
+#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
--
2.7.1
More information about the ffmpeg-devel
mailing list