Commit eb07f4cc authored by Stefano Sabatini's avatar Stefano Sabatini

lavfi/drawtext: rename and document variables d_expr and d_pexpr

Use the more expressive names draw_expr and draw_pexpr, also more
consistent.
parent 56b39bd5
......@@ -147,8 +147,8 @@ typedef struct {
AVExpr *x_pexpr, *y_pexpr; ///< parsed expressions for x and y
int64_t basetime; ///< base pts time in the real world for display
double var_values[VAR_VARS_NB];
char *d_expr;
AVExpr *d_pexpr;
char *draw_expr; ///< expression for draw
AVExpr *draw_pexpr; ///< parsed expression for draw
int draw; ///< set to zero to prevent drawing
AVLFG prng; ///< random
char *tc_opt_string; ///< specified timecode option string
......@@ -175,7 +175,7 @@ static const AVOption drawtext_options[]= {
{"shadowy", "set y", OFFSET(shadowy), AV_OPT_TYPE_INT, {.dbl=0}, INT_MIN, INT_MAX },
{"tabsize", "set tab size", OFFSET(tabsize), AV_OPT_TYPE_INT, {.dbl=4}, 0, INT_MAX },
{"basetime", "set base time", OFFSET(basetime), AV_OPT_TYPE_INT64, {.dbl=AV_NOPTS_VALUE}, INT64_MIN, INT64_MAX },
{"draw", "if false do not draw", OFFSET(d_expr), AV_OPT_TYPE_STRING, {.str="1"}, CHAR_MIN, CHAR_MAX },
{"draw", "if false do not draw", OFFSET(draw_expr), AV_OPT_TYPE_STRING, {.str="1"}, CHAR_MIN, CHAR_MAX },
{"timecode", "set initial timecode", OFFSET(tc_opt_string), AV_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX },
{"tc24hmax", "set 24 hours max (timecode only)", OFFSET(tc24hmax), AV_OPT_TYPE_INT, {.dbl=0}, 0, 1 },
{"r", "set rate (timecode only)", OFFSET(tc_rate), AV_OPT_TYPE_RATIONAL, {.dbl=0}, 0, INT_MAX },
......@@ -515,7 +515,7 @@ static av_cold void uninit(AVFilterContext *ctx)
av_expr_free(dtext->x_pexpr); dtext->x_pexpr = NULL;
av_expr_free(dtext->y_pexpr); dtext->y_pexpr = NULL;
av_expr_free(dtext->d_pexpr); dtext->d_pexpr = NULL;
av_expr_free(dtext->draw_pexpr); dtext->draw_pexpr = NULL;
av_freep(&dtext->boxcolor_string);
av_freep(&dtext->expanded_text);
......@@ -525,7 +525,7 @@ static av_cold void uninit(AVFilterContext *ctx)
av_freep(&dtext->text);
av_freep(&dtext->x_expr);
av_freep(&dtext->y_expr);
av_freep(&dtext->d_expr);
av_freep(&dtext->draw_expr);
av_freep(&dtext->positions);
dtext->nb_positions = 0;
......@@ -572,7 +572,7 @@ static int config_input(AVFilterLink *inlink)
NULL, NULL, fun2_names, fun2, 0, ctx)) < 0 ||
(ret = av_expr_parse(&dtext->y_pexpr, dtext->y_expr, var_names,
NULL, NULL, fun2_names, fun2, 0, ctx)) < 0 ||
(ret = av_expr_parse(&dtext->d_pexpr, dtext->d_expr, var_names,
(ret = av_expr_parse(&dtext->draw_pexpr, dtext->draw_expr, var_names,
NULL, NULL, fun2_names, fun2, 0, ctx)) < 0)
return AVERROR(EINVAL);
......@@ -767,7 +767,7 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref,
dtext->x = dtext->var_values[VAR_X] = av_expr_eval(dtext->x_pexpr, dtext->var_values, &dtext->prng);
dtext->y = dtext->var_values[VAR_Y] = av_expr_eval(dtext->y_pexpr, dtext->var_values, &dtext->prng);
dtext->x = dtext->var_values[VAR_X] = av_expr_eval(dtext->x_pexpr, dtext->var_values, &dtext->prng);
dtext->draw = av_expr_eval(dtext->d_pexpr, dtext->var_values, &dtext->prng);
dtext->draw = av_expr_eval(dtext->draw_pexpr, dtext->var_values, &dtext->prng);
if(!dtext->draw)
return 0;
......
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