diff options
author | Michael Kuron <michael.kuron@gmail.com> | 2020-02-03 20:42:31 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-02-04 23:34:22 +0100 |
commit | d4440c7e91b0ef5f6776d98c51dbb6cd66ea0194 (patch) | |
tree | 0ad69a9506c4ce947bcb2ea9eed9a6d9e514fe07 /libavcodec/dvdsubenc.c | |
parent | bf070a9171d9d5b3603e5bcf7e72dd9e584a3b83 (diff) | |
download | ffmpeg-d4440c7e91b0ef5f6776d98c51dbb6cd66ea0194.tar.gz |
lavc/dvdsubenc: accept palette from options
Previously, the default palette would always be used.
Now, we can accept a custom palette, just like dvdsubdec does.
Signed-off-by: Michael Kuron <michael.kuron@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/dvdsubenc.c')
-rw-r--r-- | libavcodec/dvdsubenc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c index ff95ed2002..e54b5f0d7b 100644 --- a/libavcodec/dvdsubenc.c +++ b/libavcodec/dvdsubenc.c @@ -29,6 +29,7 @@ typedef struct { AVClass *class; uint32_t global_palette[16]; + char *palette_str; int even_rows_fix; } DVDSubtitleContext; @@ -436,7 +437,11 @@ static int dvdsub_init(AVCodecContext *avctx) int i, ret; av_assert0(sizeof(dvdc->global_palette) == sizeof(default_palette)); - memcpy(dvdc->global_palette, default_palette, sizeof(dvdc->global_palette)); + if (dvdc->palette_str) { + ff_dvdsub_parse_palette(dvdc->global_palette, dvdc->palette_str); + } else { + memcpy(dvdc->global_palette, default_palette, sizeof(dvdc->global_palette)); + } av_bprint_init(&extradata, 0, AV_BPRINT_SIZE_AUTOMATIC); if (avctx->width && avctx->height) @@ -467,6 +472,7 @@ static int dvdsub_encode(AVCodecContext *avctx, #define OFFSET(x) offsetof(DVDSubtitleContext, x) #define SE AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { + {"palette", "set the global palette", OFFSET(palette_str), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SE }, {"even_rows_fix", "Make number of rows even (workaround for some players)", OFFSET(even_rows_fix), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, SE}, { NULL }, }; |