From 30e76853608f150450fac2497179159a6d556e12 Mon Sep 17 00:00:00 2001 From: Clément Bœsch Date: Sat, 20 Feb 2016 21:27:45 +0100 Subject: lavc/options: add ass_ro_flush_noop to flags2 --- 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 +- 9 files changed, 18 insertions(+), 7 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/ass.c b/libavcodec/ass.c index da0ee18091..b4f081c819 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 d3e035ac3e..695ca053e1 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 44c3b987e1..d3f32ddde9 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 8b031fa0f6..a81f924822 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 fa70497439..abf8711a9c 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 b493dd17c5..1a028621fd 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 2874e216f9..16f3f58c1c 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 4e2ff2c144..964da72ad5 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 fc5d8bfff6..decc4a4c46 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, \ -- cgit v1.2.3