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 { ...@@ -147,8 +147,8 @@ typedef struct {
AVExpr *x_pexpr, *y_pexpr; ///< parsed expressions for x and y AVExpr *x_pexpr, *y_pexpr; ///< parsed expressions for x and y
int64_t basetime; ///< base pts time in the real world for display int64_t basetime; ///< base pts time in the real world for display
double var_values[VAR_VARS_NB]; double var_values[VAR_VARS_NB];
char *d_expr; char *draw_expr; ///< expression for draw
AVExpr *d_pexpr; AVExpr *draw_pexpr; ///< parsed expression for draw
int draw; ///< set to zero to prevent drawing int draw; ///< set to zero to prevent drawing
AVLFG prng; ///< random AVLFG prng; ///< random
char *tc_opt_string; ///< specified timecode option string char *tc_opt_string; ///< specified timecode option string
...@@ -175,7 +175,7 @@ static const AVOption drawtext_options[]= { ...@@ -175,7 +175,7 @@ static const AVOption drawtext_options[]= {
{"shadowy", "set y", OFFSET(shadowy), AV_OPT_TYPE_INT, {.dbl=0}, INT_MIN, INT_MAX }, {"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 }, {"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 }, {"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 }, {"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 }, {"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 }, {"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) ...@@ -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->x_pexpr); dtext->x_pexpr = NULL;
av_expr_free(dtext->y_pexpr); dtext->y_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->boxcolor_string);
av_freep(&dtext->expanded_text); av_freep(&dtext->expanded_text);
...@@ -525,7 +525,7 @@ static av_cold void uninit(AVFilterContext *ctx) ...@@ -525,7 +525,7 @@ static av_cold void uninit(AVFilterContext *ctx)
av_freep(&dtext->text); av_freep(&dtext->text);
av_freep(&dtext->x_expr); av_freep(&dtext->x_expr);
av_freep(&dtext->y_expr); av_freep(&dtext->y_expr);
av_freep(&dtext->d_expr); av_freep(&dtext->draw_expr);
av_freep(&dtext->positions); av_freep(&dtext->positions);
dtext->nb_positions = 0; dtext->nb_positions = 0;
...@@ -572,7 +572,7 @@ static int config_input(AVFilterLink *inlink) ...@@ -572,7 +572,7 @@ static int config_input(AVFilterLink *inlink)
NULL, NULL, fun2_names, fun2, 0, ctx)) < 0 || NULL, NULL, fun2_names, fun2, 0, ctx)) < 0 ||
(ret = av_expr_parse(&dtext->y_pexpr, dtext->y_expr, var_names, (ret = av_expr_parse(&dtext->y_pexpr, dtext->y_expr, var_names,
NULL, NULL, fun2_names, fun2, 0, ctx)) < 0 || 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) NULL, NULL, fun2_names, fun2, 0, ctx)) < 0)
return AVERROR(EINVAL); return AVERROR(EINVAL);
...@@ -767,7 +767,7 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref, ...@@ -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->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->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->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) if(!dtext->draw)
return 0; 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