mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-24 00:02:52 +00:00
avfilter/vf_cover_rect: clip rectangle if it is partly outside the input
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
0eec40b713
commit
b4cc7d67f5
@ -163,6 +163,17 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
return ff_filter_frame(ctx->outputs[0], in);
|
return ff_filter_frame(ctx->outputs[0], in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (x < 0) {
|
||||||
|
w += x;
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
if (y < 0) {
|
||||||
|
h += y;
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
w = FFMIN(w, in->width - x);
|
||||||
|
h = FFMIN(h, in->height - y);
|
||||||
|
|
||||||
if (w > in->width || h > in->height || w <= 0 || h <= 0)
|
if (w > in->width || h > in->height || w <= 0 || h <= 0)
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user