[FFmpeg-devel] [PATCH 08/13] lavc/samidec: add support for configuring default style via AVOptions

rcombs rcombs at rcombs.me
Sat Jan 25 04:01:55 EET 2020


---
 libavcodec/textdec.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/textdec.c b/libavcodec/textdec.c
index 964da72ad5..72eb7c4795 100644
--- a/libavcodec/textdec.c
+++ b/libavcodec/textdec.c
@@ -30,15 +30,17 @@
 
 typedef struct {
     AVClass *class;
+    int readorder;
+    FFASSHeaderOptions common;
     const char *linebreaks;
     int keep_ass_markup;
-    int readorder;
 } TextContext;
 
 #define OFFSET(x) offsetof(TextContext, x)
 #define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
 static const AVOption options[] = {
     { "keep_ass_markup", "Set if ASS tags must be escaped", OFFSET(keep_ass_markup), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags=SD },
+    ASS_HEADER_AVOPTIONS(TextContext, common)
     { NULL }
 };
 
@@ -88,7 +90,7 @@ AVCodec ff_text_decoder = {
     .type           = AVMEDIA_TYPE_SUBTITLE,
     .id             = AV_CODEC_ID_TEXT,
     .decode         = text_decode_frame,
-    .init           = ff_ass_subtitle_header_default,
+    .init           = ff_ass_subtitle_header_options,
     .priv_class     = &text_decoder_class,
     .flush          = text_flush,
 };
@@ -100,7 +102,7 @@ static int linebreak_init(AVCodecContext *avctx)
 {
     TextContext *text = avctx->priv_data;
     text->linebreaks = "|";
-    return ff_ass_subtitle_header_default(avctx);
+    return ff_ass_subtitle_header_from_opts(avctx, &text->common);
 }
 
 #if CONFIG_VPLAYER_DECODER
-- 
2.24.1



More information about the ffmpeg-devel mailing list