lavc/options: add ass_ro_flush_noop to flags2

This commit is contained in:
Clément Bœsch 2016-02-20 21:27:45 +01:00
parent 2941282124
commit 30e7685360
10 changed files with 24 additions and 7 deletions

View File

@ -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).

View File

@ -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,

View File

@ -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)

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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 = {

View File

@ -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" },

View File

@ -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 = {

View File

@ -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 = { \

View File

@ -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, \