[FFmpeg-devel] [PATCH] vf_subtitles: add line_spacing option

Jean First jeanfirst at gmail.com
Thu May 16 23:35:54 CEST 2013


Signed-off-by: Jean First <jeanfirst at gmail.com>
---
 doc/filters.texi           | 3 +++
 libavfilter/vf_subtitles.c | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index cf2c1a4..3972833 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6158,6 +6158,9 @@ Specify the size of the original video, the video for which the ASS file
 was composed. 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 line_spacing
+Specify the height of the line spacing.
+
 @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 b5f5bc9..f90e06c 100644
--- a/libavfilter/vf_subtitles.c
+++ b/libavfilter/vf_subtitles.c
@@ -28,6 +28,7 @@
  */
 
 #include <ass/ass.h>
+#include <float.h>
 
 #include "config.h"
 #if CONFIG_SUBTITLES_FILTER
@@ -54,6 +55,7 @@ typedef struct {
     uint8_t rgba_map[4];
     int     pix_step[4];       ///< steps per pixel for each plane of the main output
     int original_w, original_h;
+    double line_spacing;
     FFDrawContext draw;
 } AssContext;
 
@@ -64,6 +66,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 }, \
+    {"line_spacing",   "set the height of the line spacing",                       OFFSET(line_spacing), AV_OPT_TYPE_DOUBLE,   {.dbl = 0.0},   0.0,  DBL_MAX,  FLAGS }, \
 
 /* libass supports a log level ranging from 0 to 7 */
 static const int ass_libavfilter_log_level_map[] = {
@@ -139,6 +142,8 @@ static int config_input(AVFilterLink *inlink)
     if (ass->original_w && ass->original_h)
         ass_set_aspect_ratio(ass->renderer, (double)inlink->w / inlink->h,
                              (double)ass->original_w / ass->original_h);
+    if (ass->line_spacing)
+        ass_set_line_spacing(ass->renderer, ass->line_spacing);
 
     return 0;
 }
-- 
1.7.12.4 (Apple Git-37)



More information about the ffmpeg-devel mailing list