diff options
author | John Stebbins <stebbins@jetheaddev.com> | 2015-10-25 11:36:10 -0700 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2015-11-06 15:03:51 +0100 |
commit | 2ec112f71cd03ccab1b6f9a00d29199a57bcc7a5 (patch) | |
tree | ec2e3f8df2026d23dcd8ee546545ffee2a5110f8 /libavfilter | |
parent | e2854e731f843906d9a9a5b882bed872341999fd (diff) | |
download | ffmpeg-2ec112f71cd03ccab1b6f9a00d29199a57bcc7a5.tar.gz |
vf_pad: fix x, y option expression evaluation
Calculation of x an y based on width and height did not work when
width == 0 or height == 0. "0" substitutes the input width and
height, but did so too late for x, y expression evaluation.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vf_pad.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c index 634af4c941..cddd2a6b2a 100644 --- a/libavfilter/vf_pad.c +++ b/libavfilter/vf_pad.c @@ -167,12 +167,17 @@ static int config_input(AVFilterLink *inlink) NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0) goto eval_fail; s->h = var_values[VAR_OUT_H] = var_values[VAR_OH] = res; + if (!s->h) + var_values[VAR_OUT_H] = var_values[VAR_OH] = s->h = inlink->h; + /* evaluate the width again, as it may depend on the evaluated output height */ if ((ret = av_expr_parse_and_eval(&res, (expr = s->w_expr), var_names, var_values, NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0) goto eval_fail; s->w = var_values[VAR_OUT_W] = var_values[VAR_OW] = res; + if (!s->w) + var_values[VAR_OUT_W] = var_values[VAR_OW] = s->w = inlink->w; /* evaluate x and y */ av_expr_parse_and_eval(&res, (expr = s->x_expr), @@ -197,11 +202,6 @@ static int config_input(AVFilterLink *inlink) return AVERROR(EINVAL); } - if (!s->w) - s->w = inlink->w; - if (!s->h) - s->h = inlink->h; - s->w &= ~((1 << s->hsub) - 1); s->h &= ~((1 << s->vsub) - 1); s->x &= ~((1 << s->hsub) - 1); |