diff options
author | Eejya Singh <singh.eejya@gmail.com> | 2015-01-28 17:41:42 +0530 |
---|---|---|
committer | Clément Bœsch <u@pkh.me> | 2015-02-08 11:36:49 +0100 |
commit | 40b198e98736819f647f794e57517d1b42e85791 (patch) | |
tree | 85a759c8797a0b5845c7ff0ac819621b844f097f /libavfilter/vf_subtitles.c | |
parent | 5ae140c04f027da708859bb046e032a593fd81ad (diff) | |
download | ffmpeg-40b198e98736819f647f794e57517d1b42e85791.tar.gz |
lavfi/subtitles: add force_style option
Signed-off-by: Eejya Singh <singh.eejya@gmail.com>
Signed-off-by: Clément Bœsch <u@pkh.me>
Diffstat (limited to 'libavfilter/vf_subtitles.c')
-rw-r--r-- | libavfilter/vf_subtitles.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c index be4c6a534d..f7fc1a6707 100644 --- a/libavfilter/vf_subtitles.c +++ b/libavfilter/vf_subtitles.c @@ -51,6 +51,7 @@ typedef struct { ASS_Track *track; char *filename; char *charenc; + char *force_style; int stream_index; uint8_t rgba_map[4]; int pix_step[4]; ///< steps per pixel for each plane of the main output @@ -260,6 +261,7 @@ static const AVOption subtitles_options[] = { {"charenc", "set input character encoding", OFFSET(charenc), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS}, {"stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS}, {"si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS}, + {"force_style", "force subtitle style", OFFSET(force_style), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS}, {NULL}, }; @@ -392,6 +394,27 @@ static av_cold int init_subtitles(AVFilterContext *ctx) if (ret < 0) goto end; + if (ass->force_style) { + char **list = NULL; + char *temp = NULL; + char *ptr = av_strtok(ass->force_style, ",", &temp); + int i = 0; + while (ptr) { + av_dynarray_add(&list, &i, ptr); + if (!list) { + ret = AVERROR(ENOMEM); + goto end; + } + ptr = av_strtok(NULL, ",", &temp); + } + av_dynarray_add(&list, &i, NULL); + if (!list) { + ret = AVERROR(ENOMEM); + goto end; + } + ass_set_style_overrides(ass->library, list); + av_free(list); + } /* Decode subtitles and push them into the renderer (libass) */ if (dec_ctx->subtitle_header) ass_process_codec_private(ass->track, |