Guest User

Untitled

a guest
Feb 1st, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. commit bec333c4d3e8a0f63d9c5667eac92c1b092883f2
  2. Author: Eejya Singh <[email protected]>
  3. Date: Wed Jan 28 17:41:42 2015 +0530
  4.  
  5. Adding Force Style option in Subtitles Filter
  6.  
  7. Signed-off-by: Eejya Singh <[email protected]>
  8.  
  9. diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
  10. index be4c6a5..f8e5d45 100644
  11. --- a/libavfilter/vf_subtitles.c
  12. +++ b/libavfilter/vf_subtitles.c
  13. @@ -51,6 +51,7 @@ typedef struct {
  14. ASS_Track *track;
  15. char *filename;
  16. char *charenc;
  17. + char *force_style;
  18. int stream_index;
  19. uint8_t rgba_map[4];
  20. int pix_step[4]; ///< steps per pixel for each plane of the main output
  21. @@ -260,6 +261,7 @@ static const AVOption subtitles_options[] = {
  22. {"charenc", "set input character encoding", OFFSET(charenc), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS},
  23. {"stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS},
  24. {"si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS},
  25. + {"force_style", "force subtitle style", OFFSET(force_style), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS},
  26. {NULL},
  27. };
  28.  
  29. @@ -389,6 +391,27 @@ static av_cold int init_subtitles(AVFilterContext *ctx)
  30. if (ass->charenc)
  31. av_dict_set(&codec_opts, "sub_charenc", ass->charenc, 0);
  32. ret = avcodec_open2(dec_ctx, dec, &codec_opts);
  33. +
  34. + if (ass->force_style){
  35. +
  36. + av_log(ctx, 0, "User Input is %s\n",ass->force_style);
  37. + char **list = NULL;
  38. + char *temp;
  39. + char *ptr = av_strtok(ass->force_style,",",&temp);
  40. + int i=0;
  41. + while(ptr)
  42. + {
  43. + list = av_realloc(list,sizeof(char *)*(i+1));
  44. + list[i] = ptr;
  45. + ptr = av_strtok(NULL, ",",&temp);
  46. + i++;
  47. + }
  48. + list = av_realloc(list,sizeof(char *)*(i+1));
  49. + av_log(ctx, 0, "I value is %d\n",i);
  50. + list[i]=NULL;
  51. + ass_set_style_overrides(ass->library,list);
  52. + //ass_process_force_style(ass->track);
  53. + }
  54. if (ret < 0)
  55. goto end;
Advertisement
Add Comment
Please, Sign In to add comment