diff mbox series

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

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

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

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

Patch

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,
 };