Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit bec333c4d3e8a0f63d9c5667eac92c1b092883f2
- Author: Eejya Singh <[email protected]>
- Date: Wed Jan 28 17:41:42 2015 +0530
- Adding Force Style option in Subtitles Filter
- Signed-off-by: Eejya Singh <[email protected]>
- diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
- index be4c6a5..f8e5d45 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},
- };
- @@ -389,6 +391,27 @@ static av_cold int init_subtitles(AVFilterContext *ctx)
- if (ass->charenc)
- av_dict_set(&codec_opts, "sub_charenc", ass->charenc, 0);
- ret = avcodec_open2(dec_ctx, dec, &codec_opts);
- +
- + if (ass->force_style){
- +
- + av_log(ctx, 0, "User Input is %s\n",ass->force_style);
- + char **list = NULL;
- + char *temp;
- + char *ptr = av_strtok(ass->force_style,",",&temp);
- + int i=0;
- + while(ptr)
- + {
- + list = av_realloc(list,sizeof(char *)*(i+1));
- + list[i] = ptr;
- + ptr = av_strtok(NULL, ",",&temp);
- + i++;
- + }
- + list = av_realloc(list,sizeof(char *)*(i+1));
- + av_log(ctx, 0, "I value is %d\n",i);
- + list[i]=NULL;
- + ass_set_style_overrides(ass->library,list);
- + //ass_process_force_style(ass->track);
- + }
- if (ret < 0)
- goto end;
Advertisement
Add Comment
Please, Sign In to add comment