Commit 90096e42 authored by Steven Liu's avatar Steven Liu

avfilter:vf_drawtext: add new line space size set parameter

add line_spacing parameter to set the space between two lines

Based on an idea by: Leandro Santiago <leandrosansilva@gmail.com>
Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarSteven Liu <lq@chinaffmpeg.org>
parent b05d0274
...@@ -6750,6 +6750,10 @@ option, check the "Color" section in the ffmpeg-utils manual. ...@@ -6750,6 +6750,10 @@ option, check the "Color" section in the ffmpeg-utils manual.
The default value of @var{boxcolor} is "white". The default value of @var{boxcolor} is "white".
@item line_spacing
Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
The default value of @var{line_spacing} is 0.
@item borderw @item borderw
Set the width of the border to be drawn around the text using @var{bordercolor}. Set the width of the border to be drawn around the text using @var{bordercolor}.
The default value of @var{borderw} is 0. The default value of @var{borderw} is 0.
......
...@@ -158,6 +158,7 @@ typedef struct DrawTextContext { ...@@ -158,6 +158,7 @@ typedef struct DrawTextContext {
int borderw; ///< border width int borderw; ///< border width
unsigned int fontsize; ///< font size to use unsigned int fontsize; ///< font size to use
int line_spacing; ///< lines spacing in pixels
short int draw_box; ///< draw box around text - true or false short int draw_box; ///< draw box around text - true or false
int boxborderw; ///< box border width int boxborderw; ///< box border width
int use_kerning; ///< font kerning is used - true/false int use_kerning; ///< font kerning is used - true/false
...@@ -209,6 +210,7 @@ static const AVOption drawtext_options[]= { ...@@ -209,6 +210,7 @@ static const AVOption drawtext_options[]= {
{"shadowcolor", "set shadow color", OFFSET(shadowcolor.rgba), AV_OPT_TYPE_COLOR, {.str="black"}, CHAR_MIN, CHAR_MAX, FLAGS}, {"shadowcolor", "set shadow color", OFFSET(shadowcolor.rgba), AV_OPT_TYPE_COLOR, {.str="black"}, CHAR_MIN, CHAR_MAX, FLAGS},
{"box", "set box", OFFSET(draw_box), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 , FLAGS}, {"box", "set box", OFFSET(draw_box), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 , FLAGS},
{"boxborderw", "set box border width", OFFSET(boxborderw), AV_OPT_TYPE_INT, {.i64=0}, INT_MIN, INT_MAX , FLAGS}, {"boxborderw", "set box border width", OFFSET(boxborderw), AV_OPT_TYPE_INT, {.i64=0}, INT_MIN, INT_MAX , FLAGS},
{"line_spacing", "set line spacing in pixels", OFFSET(line_spacing), AV_OPT_TYPE_INT, {.i64=0}, INT_MIN, INT_MAX,FLAGS},
{"fontsize", "set font size", OFFSET(fontsize), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX , FLAGS}, {"fontsize", "set font size", OFFSET(fontsize), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX , FLAGS},
{"x", "set x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX, FLAGS}, {"x", "set x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX, FLAGS},
{"y", "set y expression", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX, FLAGS}, {"y", "set y expression", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX, FLAGS},
...@@ -1250,7 +1252,7 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame, ...@@ -1250,7 +1252,7 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame,
if (is_newline(code)) { if (is_newline(code)) {
max_text_line_w = FFMAX(max_text_line_w, x); max_text_line_w = FFMAX(max_text_line_w, x);
y += s->max_glyph_h; y += s->max_glyph_h + s->line_spacing;
x = 0; x = 0;
continue; continue;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment