avfilter/vf_drawtext: cosmetics

This commit is contained in:
yethie 2023-05-15 17:00:30 +02:00 committed by Paul B Mahol
parent 17499f43b1
commit ba00ed33e5

View File

@ -78,8 +78,8 @@ static const char *const var_names[] = {
"line_h", "lh", ///< line height, same as max_glyph_h "line_h", "lh", ///< line height, same as max_glyph_h
"main_h", "h", "H", ///< height of the input video "main_h", "h", "H", ///< height of the input video
"main_w", "w", "W", ///< width of the input video "main_w", "w", "W", ///< width of the input video
"max_glyph_a", "ascent", ///< max glyph ascent "max_glyph_a", "ascent", ///< max glyph ascender
"max_glyph_d", "descent", ///< min glyph descent "max_glyph_d", "descent", ///< min glyph descender
"max_glyph_h", ///< max glyph height "max_glyph_h", ///< max glyph height
"max_glyph_w", ///< max glyph width "max_glyph_w", ///< max glyph width
"n", ///< number of frame "n", ///< number of frame
@ -236,7 +236,7 @@ static const AVOption drawtext_options[]= {
{"bordercolor", "set border color", OFFSET(bordercolor.rgba), AV_OPT_TYPE_COLOR, {.str="black"}, 0, 0, FLAGS}, {"bordercolor", "set border color", OFFSET(bordercolor.rgba), AV_OPT_TYPE_COLOR, {.str="black"}, 0, 0, FLAGS},
{"shadowcolor", "set shadow color", OFFSET(shadowcolor.rgba), AV_OPT_TYPE_COLOR, {.str="black"}, 0, 0, FLAGS}, {"shadowcolor", "set shadow color", OFFSET(shadowcolor.rgba), AV_OPT_TYPE_COLOR, {.str="black"}, 0, 0, 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 borders 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}, {"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_expr), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS}, {"fontsize", "set font size", OFFSET(fontsize_expr), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS},
{"x", "set x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str="0"}, 0, 0, FLAGS}, {"x", "set x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str="0"}, 0, 0, FLAGS},
@ -447,7 +447,6 @@ static av_cold int update_fontsize(AVFilterContext *ctx)
return err; return err;
size = av_expr_eval(s->fontsize_pexpr, s->var_values, &s->prng); size = av_expr_eval(s->fontsize_pexpr, s->var_values, &s->prng);
if (!isnan(size)) { if (!isnan(size)) {
roundedsize = round(size); roundedsize = round(size);
// test for overflow before cast // test for overflow before cast
@ -455,7 +454,6 @@ static av_cold int update_fontsize(AVFilterContext *ctx)
av_log(ctx, AV_LOG_ERROR, "fontsize overflow\n"); av_log(ctx, AV_LOG_ERROR, "fontsize overflow\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
fontsize = roundedsize; fontsize = roundedsize;
} }
} }
@ -556,7 +554,7 @@ static int load_font_fontconfig(AVFilterContext *ctx)
goto fail; goto fail;
} }
av_log(ctx, AV_LOG_INFO, "Using \"%s\"\n", filename); av_log(ctx, AV_LOG_VERBOSE, "Using \"%s\"\n", filename);
if (parse_err) if (parse_err)
s->default_fontsize = size + 0.5; s->default_fontsize = size + 0.5;
@ -698,6 +696,7 @@ static int shape_text(AVFilterContext *ctx)
s->text = tmp; s->text = tmp;
len = fribidi_unicode_to_charset(FRIBIDI_CHAR_SET_UTF8, len = fribidi_unicode_to_charset(FRIBIDI_CHAR_SET_UTF8,
unicodestr, len, s->text); unicodestr, len, s->text);
ret = 0; ret = 0;
out: out: