Signed-off-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -3955,6 +3955,10 @@ Used to draw a box around text using the background color. |
3955 | 3955 |
The value must be either 1 (enable) or 0 (disable). |
3956 | 3956 |
The default value of @var{box} is 0. |
3957 | 3957 |
|
3958 |
+@item boxborderw |
|
3959 |
+Set the width of the border to be drawn around the box using @var{boxcolor}. |
|
3960 |
+The default value of @var{boxborderw} is 0. |
|
3961 |
+ |
|
3958 | 3962 |
@item boxcolor |
3959 | 3963 |
The color to be used for drawing box around text. For the syntax of this |
3960 | 3964 |
option, check the "Color" section in the ffmpeg-utils manual. |
... | ... |
@@ -159,6 +159,7 @@ typedef struct DrawTextContext { |
159 | 159 |
unsigned int fontsize; ///< font size to use |
160 | 160 |
|
161 | 161 |
short int draw_box; ///< draw box around text - true or false |
162 |
+ int boxborderw; ///< box border width |
|
162 | 163 |
int use_kerning; ///< font kerning is used - true/false |
163 | 164 |
int tabsize; ///< tab size |
164 | 165 |
int fix_bounds; ///< do we let it go out of frame bounds - t/f |
... | ... |
@@ -204,6 +205,7 @@ static const AVOption drawtext_options[]= { |
204 | 204 |
{"bordercolor", "set border color", OFFSET(bordercolor.rgba), AV_OPT_TYPE_COLOR, {.str="black"}, CHAR_MIN, CHAR_MAX, FLAGS}, |
205 | 205 |
{"shadowcolor", "set shadow color", OFFSET(shadowcolor.rgba), AV_OPT_TYPE_COLOR, {.str="black"}, CHAR_MIN, CHAR_MAX, FLAGS}, |
206 | 206 |
{"box", "set box", OFFSET(draw_box), AV_OPT_TYPE_INT, {.i64=0}, 0, 1 , FLAGS}, |
207 |
+ {"boxborderw", "set box border width", OFFSET(boxborderw), AV_OPT_TYPE_INT, {.i64=0}, INT_MIN, INT_MAX , FLAGS}, |
|
207 | 208 |
{"fontsize", "set font size", OFFSET(fontsize), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX , FLAGS}, |
208 | 209 |
{"x", "set x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX, FLAGS}, |
209 | 210 |
{"y", "set y expression", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX, FLAGS}, |
... | ... |
@@ -1245,7 +1247,8 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame, |
1245 | 1245 |
if (s->draw_box) |
1246 | 1246 |
ff_blend_rectangle(&s->dc, &s->boxcolor, |
1247 | 1247 |
frame->data, frame->linesize, width, height, |
1248 |
- s->x, s->y, box_w, box_h); |
|
1248 |
+ s->x - s->boxborderw, s->y - s->boxborderw, |
|
1249 |
+ box_w + s->boxborderw * 2, box_h + s->boxborderw * 2); |
|
1249 | 1250 |
|
1250 | 1251 |
if (s->shadowx || s->shadowy) { |
1251 | 1252 |
if ((ret = draw_glyphs(s, frame, width, height, |