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

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


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

diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c
index e32f238c62..8804210700 100644
--- a/libavcodec/samidec.c
+++ b/libavcodec/samidec.c
@@ -30,12 +30,14 @@
 #include "htmlsubtitles.h"
 
 typedef struct {
+    AVClass *class;
+    int readorder;
+    FFASSHeaderOptions common;
     AVBPrint source;
     AVBPrint content;
     AVBPrint encoded_source;
     AVBPrint encoded_content;
     AVBPrint full;
-    int readorder;
 } SAMIContext;
 
 static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src)
@@ -159,7 +161,7 @@ static av_cold int sami_init(AVCodecContext *avctx)
     av_bprint_init(&sami->encoded_source,  0, 2048);
     av_bprint_init(&sami->encoded_content, 0, 2048);
     av_bprint_init(&sami->full,    0, 2048);
-    return ff_ass_subtitle_header_default(avctx);
+    return ff_ass_subtitle_header_from_opts(avctx, &sami->common);
 }
 
 static av_cold int sami_close(AVCodecContext *avctx)
@@ -180,6 +182,8 @@ static void sami_flush(AVCodecContext *avctx)
         sami->readorder = 0;
 }
 
+ASS_GENERIC_CLASS(sami, SAMI)
+
 AVCodec ff_sami_decoder = {
     .name           = "sami",
     .long_name      = NULL_IF_CONFIG_SMALL("SAMI subtitle"),
@@ -190,4 +194,5 @@ AVCodec ff_sami_decoder = {
     .close          = sami_close,
     .decode         = sami_decode_frame,
     .flush          = sami_flush,
+    .priv_class     = &sami_decoder_class,
 };
-- 
2.24.1



More information about the ffmpeg-devel mailing list