diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-03-02 02:32:55 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-02 02:32:55 +0100 |
commit | 047fd986bf3641ad3dc137746097271c339ee5f0 (patch) | |
tree | d7d1ee79826c9a4c7c5dfec1486a869c5b17e0ee | |
parent | 85108195c5619492b28c4133525de0dedc706794 (diff) | |
download | ffmpeg-047fd986bf3641ad3dc137746097271c339ee5f0.tar.gz |
avfilter/vf_drawbox: Fix handling of max values
Fixes Ticket4332
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavfilter/vf_drawbox.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavfilter/vf_drawbox.c b/libavfilter/vf_drawbox.c index 115df884e1..799d07ead4 100644 --- a/libavfilter/vf_drawbox.c +++ b/libavfilter/vf_drawbox.c @@ -47,6 +47,7 @@ static const char *const var_names[] = { "h", ///< height of the rendered box "w", ///< width of the rendered box "t", + "max", NULL }; @@ -63,6 +64,7 @@ enum var_name { VAR_H, VAR_W, VAR_T, + VAR_MAX, VARS_NB }; @@ -142,30 +144,35 @@ static int config_input(AVFilterLink *inlink) for (i = 0; i <= NUM_EXPR_EVALS; i++) { /* evaluate expressions, fail on last iteration */ + var_values[VAR_MAX] = inlink->w; if ((ret = av_expr_parse_and_eval(&res, (expr = s->x_expr), var_names, var_values, NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0 && i == NUM_EXPR_EVALS) goto fail; s->x = var_values[VAR_X] = res; + var_values[VAR_MAX] = inlink->h; if ((ret = av_expr_parse_and_eval(&res, (expr = s->y_expr), var_names, var_values, NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0 && i == NUM_EXPR_EVALS) goto fail; s->y = var_values[VAR_Y] = res; + var_values[VAR_MAX] = inlink->w - s->x; if ((ret = av_expr_parse_and_eval(&res, (expr = s->w_expr), var_names, var_values, NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0 && i == NUM_EXPR_EVALS) goto fail; s->w = var_values[VAR_W] = res; + var_values[VAR_MAX] = inlink->h - s->y; if ((ret = av_expr_parse_and_eval(&res, (expr = s->h_expr), var_names, var_values, NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0 && i == NUM_EXPR_EVALS) goto fail; s->h = var_values[VAR_H] = res; + var_values[VAR_MAX] = INT_MAX; if ((ret = av_expr_parse_and_eval(&res, (expr = s->t_expr), var_names, var_values, NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0 && i == NUM_EXPR_EVALS) |