diff mbox series

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

Message ID 20200125020200.2049-8-rcombs@rcombs.me
State New
Headers show
Series [FFmpeg-devel,01/13] lavc/ass: realign ff_ass_subtitle_header_default
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

rcombs Jan. 25, 2020, 2:01 a.m. UTC
---
 libavcodec/textdec.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

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