|
@@ -173,8 +173,13 @@ static int config_input(AVFilterLink *inlink) |
|
|
goto eval_fail; |
|
|
goto eval_fail; |
|
|
s->x = var_values[VAR_X] = res; |
|
|
s->x = var_values[VAR_X] = res; |
|
|
|
|
|
|
|
|
|
|
|
if (s->x < 0 || s->x + inlink->w > s->w) |
|
|
|
|
|
s->x = var_values[VAR_X] = (s->w - inlink->w) / 2; |
|
|
|
|
|
if (s->y < 0 || s->y + inlink->h > s->h) |
|
|
|
|
|
s->y = var_values[VAR_Y] = (s->h - inlink->h) / 2; |
|
|
|
|
|
|
|
|
/* sanity check params */ |
|
|
/* sanity check params */ |
|
|
if (s->w < 0 || s->h < 0 || s->x < 0 || s->y < 0) { |
|
|
|
|
|
|
|
|
if (s->w < 0 || s->h < 0) { |
|
|
av_log(ctx, AV_LOG_ERROR, "Negative values are not acceptable.\n"); |
|
|
av_log(ctx, AV_LOG_ERROR, "Negative values are not acceptable.\n"); |
|
|
return AVERROR(EINVAL); |
|
|
return AVERROR(EINVAL); |
|
|
} |
|
|
} |
|
@@ -192,10 +197,7 @@ static int config_input(AVFilterLink *inlink) |
|
|
inlink->w, inlink->h, s->w, s->h, s->x, s->y, |
|
|
inlink->w, inlink->h, s->w, s->h, s->x, s->y, |
|
|
s->rgba_color[0], s->rgba_color[1], s->rgba_color[2], s->rgba_color[3]); |
|
|
s->rgba_color[0], s->rgba_color[1], s->rgba_color[2], s->rgba_color[3]); |
|
|
|
|
|
|
|
|
if (s->x < 0 || s->y < 0 || |
|
|
|
|
|
s->w <= 0 || s->h <= 0 || |
|
|
|
|
|
(unsigned)s->x + (unsigned)inlink->w > s->w || |
|
|
|
|
|
(unsigned)s->y + (unsigned)inlink->h > s->h) { |
|
|
|
|
|
|
|
|
if (s->w <= 0 || s->h <= 0) { |
|
|
av_log(ctx, AV_LOG_ERROR, |
|
|
av_log(ctx, AV_LOG_ERROR, |
|
|
"Input area %d:%d:%d:%d not within the padded area 0:0:%d:%d or zero-sized\n", |
|
|
"Input area %d:%d:%d:%d not within the padded area 0:0:%d:%d or zero-sized\n", |
|
|
s->x, s->y, s->x + inlink->w, s->y + inlink->h, s->w, s->h); |
|
|
s->x, s->y, s->x + inlink->w, s->y + inlink->h, s->w, s->h); |
|
|