[FFmpeg-devel] [PATCH 12/13] lavc/libzvbi-teletextdec: add support for configuring default style via AVOptions

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


---
 libavcodec/libzvbi-teletextdec.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c
index 3515f33924..018b350511 100644
--- a/libavcodec/libzvbi-teletextdec.c
+++ b/libavcodec/libzvbi-teletextdec.c
@@ -78,11 +78,14 @@ typedef struct TeletextContext
     int             last_pgno;
     int             last_p5;
     int             last_ass_alignment;
+
+    FFASSHeaderOptions common;
 } TeletextContext;
 
 static int my_ass_subtitle_header(AVCodecContext *avctx)
 {
-    int ret = ff_ass_subtitle_header_default(avctx);
+    TeletextContext *ctx = avctx->priv_data;
+    int ret = ff_ass_subtitle_header_from_opts(avctx, &ctx->common);
     char *new_header;
     uint8_t *event_pos;
 
@@ -756,7 +759,7 @@ static int teletext_init_decoder(AVCodecContext *avctx)
         case 0:
             return 0;
         case 1:
-            return ff_ass_subtitle_header_default(avctx);
+            return ff_ass_subtitle_header_from_opts(avctx, &ctx->common);
         case 2:
             return my_ass_subtitle_header(avctx);
     }
@@ -803,6 +806,7 @@ static const AVOption options[] = {
     {"txt_duration",    "display duration of teletext pages in msecs",       OFFSET(sub_duration),   AV_OPT_TYPE_INT,    {.i64 = -1},      -1, 86400000, SD},
     {"txt_transparent", "force transparent background of the teletext",      OFFSET(transparent_bg), AV_OPT_TYPE_INT,    {.i64 = 0},        0, 1,        SD},
     {"txt_opacity",     "set opacity of the transparent background",         OFFSET(opacity),        AV_OPT_TYPE_INT,    {.i64 = -1},      -1, 255,      SD},
+    ASS_HEADER_AVOPTIONS(TeletextContext, common)
     { NULL },
 };
 
-- 
2.24.1



More information about the ffmpeg-devel mailing list