[FFmpeg-cvslog] avfilter/vf_subtitles: allow setting fonts directory

Ricardo Constantino git at videolan.org
Wed Sep 2 00:48:21 CEST 2015


ffmpeg | branch: master | Ricardo Constantino <wiiaboo at gmail.com> | Sun Aug 30 23:52:10 2015 +0100| [9dbc50b4cdaf6de5a4d52bdaa3d4d1a0df5efadd] | committer: wm4

avfilter/vf_subtitles: allow setting fonts directory

This is mostly useful if libass was compiled with a font provider
other than fontconfig, but is still useful in that case.

Signed-off-by: Ricardo Constantino <wiiaboo at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9dbc50b4cdaf6de5a4d52bdaa3d4d1a0df5efadd
---

 doc/filters.texi           |    4 ++++
 libavfilter/vf_subtitles.c |    4 ++++
 2 files changed, 8 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 892347b..3e7d2a2 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -9939,6 +9939,10 @@ was composed. For the syntax of this option, check the
 Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
 correctly scale the fonts if the aspect ratio has been changed.
 
+ at item fontsdir
+Set a directory path containing fonts that can be used by the filter.
+These fonts will be used in addition to whatever the font provider uses.
+
 @item charenc
 Set subtitles input character encoding. @code{subtitles} filter only. Only
 useful if not UTF-8.
diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
index 5e1324c..b0d016c 100644
--- a/libavfilter/vf_subtitles.c
+++ b/libavfilter/vf_subtitles.c
@@ -50,6 +50,7 @@ typedef struct {
     ASS_Renderer *renderer;
     ASS_Track    *track;
     char *filename;
+    char *fontsdir;
     char *charenc;
     char *force_style;
     int stream_index;
@@ -67,6 +68,7 @@ typedef struct {
     {"filename",       "set the filename of file to read",                         OFFSET(filename),   AV_OPT_TYPE_STRING,     {.str = NULL},  CHAR_MIN, CHAR_MAX, FLAGS }, \
     {"f",              "set the filename of file to read",                         OFFSET(filename),   AV_OPT_TYPE_STRING,     {.str = NULL},  CHAR_MIN, CHAR_MAX, FLAGS }, \
     {"original_size",  "set the size of the original video (used to scale fonts)", OFFSET(original_w), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL},  CHAR_MIN, CHAR_MAX, FLAGS }, \
+    {"fontsdir",       "set the directory containing the fonts to read",           OFFSET(fontsdir),   AV_OPT_TYPE_STRING,     {.str = NULL},  CHAR_MIN, CHAR_MAX, FLAGS }, \
 
 /* libass supports a log level ranging from 0 to 7 */
 static const int ass_libavfilter_log_level_map[] = {
@@ -106,6 +108,8 @@ static av_cold int init(AVFilterContext *ctx)
     }
     ass_set_message_cb(ass->library, ass_log, ctx);
 
+    ass_set_fonts_dir(ass->library, ass->fontsdir);
+
     ass->renderer = ass_renderer_init(ass->library);
     if (!ass->renderer) {
         av_log(ctx, AV_LOG_ERROR, "Could not initialize libass renderer.\n");



More information about the ffmpeg-cvslog mailing list