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

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


---
 libavcodec/movtextdec.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
index c38c5edce6..0bb03fc141 100644
--- a/libavcodec/movtextdec.c
+++ b/libavcodec/movtextdec.c
@@ -86,6 +86,9 @@ typedef struct {
 } TextWrapBox;
 
 typedef struct {
+    AVClass *class;
+    int readorder;
+    FFASSHeaderOptions common;
     StyleBox **s;
     StyleBox *s_temp;
     HighlightBox h;
@@ -99,7 +102,6 @@ typedef struct {
     uint64_t tracksize;
     int size_var;
     int count_s, count_f;
-    int readorder;
 } MovTextContext;
 
 typedef struct {
@@ -453,7 +455,7 @@ static int mov_text_init(AVCodecContext *avctx) {
                                 m->d.underline, ASS_DEFAULT_BORDERSTYLE,
                                 m->d.alignment);
     } else
-        return ff_ass_subtitle_header_default(avctx);
+        return ff_ass_subtitle_header_from_opts(avctx, &m->common);
 }
 
 static int mov_text_decode_frame(AVCodecContext *avctx,
@@ -567,6 +569,8 @@ static void mov_text_flush(AVCodecContext *avctx)
         m->readorder = 0;
 }
 
+ASS_GENERIC_CLASS(mov_text, "3GPP Timed Text")
+
 AVCodec ff_movtext_decoder = {
     .name         = "mov_text",
     .long_name    = NULL_IF_CONFIG_SMALL("3GPP Timed Text subtitle"),
@@ -577,4 +581,5 @@ AVCodec ff_movtext_decoder = {
     .decode       = mov_text_decode_frame,
     .close        = mov_text_decode_close,
     .flush        = mov_text_flush,
+    .priv_class   = &mov_text_decoder_class,
 };
-- 
2.24.1



More information about the ffmpeg-devel mailing list