Showing the changes to libavfilter (1 of 2 files). Show all
Unified · Split
| @@ -292,6 +292,20 @@ static int config_input(AVFilterLink *inlink) · 291 unmodified lines | ||
| 292 | 292 | s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w); |
| 293 | 293 | s->planewidth[0] = s->planewidth[3] = inlink->w; |
| 294 | 294 | |
| 295 | + if (inlink->w < s->left + s->right || | |
| 296 | + inlink->w <= s->left || | |
| 297 | + inlink->w <= s->right || | |
| 298 | + inlink->h < s->top + s->bottom || | |
| 299 | + inlink->h <= s->top || | |
| 300 | + inlink->h <= s->bottom || | |
| 301 | + inlink->w < s->left * 2 || | |
| 302 | + inlink->w < s->right * 2 || | |
| 303 | + inlink->h < s->top * 2 || | |
| 304 | + inlink->h < s->bottom * 2) { | |
| 305 | + av_log(ctx, AV_LOG_ERROR, "Borders are bigger than input frame size.\n"); | |
| 306 | + return AVERROR(EINVAL); | |
| 307 | + } | |
| 308 | + | |
| 295 | 309 | s->borders[0].left = s->borders[3].left = s->left; |
| 296 | 310 | s->borders[0].right = s->borders[3].right = s->right; |
| 297 | 311 | s->borders[0].top = s->borders[3].top = s->top; |
| @@ -307,20 +321,6 @@ static int config_input(AVFilterLink *inlink) · 9 unmodified lines | ||
| 307 | 321 | s->borders[2].top = s->top >> desc->log2_chroma_h; |
| 308 | 322 | s->borders[2].bottom = s->bottom >> desc->log2_chroma_h; |
| 309 | 323 | |
| 310 | − if (inlink->w < s->left + s->right || | |
| 311 | − inlink->w <= s->left || | |
| 312 | − inlink->w <= s->right || | |
| 313 | − inlink->h < s->top + s->bottom || | |
| 314 | − inlink->h <= s->top || | |
| 315 | − inlink->h <= s->bottom || | |
| 316 | − inlink->w < s->left * 2 || | |
| 317 | − inlink->w < s->right * 2 || | |
| 318 | − inlink->h < s->top * 2 || | |
| 319 | − inlink->h < s->bottom * 2) { | |
| 320 | − av_log(ctx, AV_LOG_ERROR, "Borders are bigger than input frame size.\n"); | |
| 321 | − return AVERROR(EINVAL); | |
| 322 | − } | |
| 323 | − | |
| 324 | 324 | switch (s->mode) { |
| 325 | 325 | case FM_SMEAR: s->fillborders = s->depth <= 8 ? smear_borders8 : smear_borders16; break; |
| 326 | 326 | case FM_MIRROR: s->fillborders = s->depth <= 8 ? mirror_borders8 : mirror_borders16; break; |
| @@ -346,8 +346,20 @@ static int config_input(AVFilterLink *inlink) · 19 unmodified lines | ||
| 346 | 346 | return 0; |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | +static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, | |
| 350 | + char *res, int res_len, int flags) | |
| 351 | +{ | |
| 352 | + int ret; | |
| 353 | + | |
| 354 | + ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags); | |
| 355 | + if (ret < 0) | |
| 356 | + return ret; | |
| 357 | + | |
| 358 | + return config_input(ctx->inputs[0]); | |
| 359 | +} | |
| 360 | + | |
| 349 | 361 | #define OFFSET(x) offsetof(FillBordersContext, x) |
| 350 | −#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM | |
| 362 | +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM | |
| 351 | 363 | |
| 352 | 364 | static const AVOption fillborders_options[] = { |
| 353 | 365 | { "left", "set the left fill border", OFFSET(left), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS }, |
| @@ -392,4 +404,5 @@ AVFilter ff_vf_fillborders = { · 38 unmodified lines | ||
| 392 | 404 | .inputs = fillborders_inputs, |
| 393 | 405 | .outputs = fillborders_outputs, |
| 394 | 406 | .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, |
| 407 | + .process_command = process_command, | |
| 395 | 408 | }; |