Needed when filtergraph reinit is disabled for the ref input.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -392,8 +392,9 @@ static int scale_slice(AVFilterLink *link, AVFrame *out_buf, AVFrame *cur_pic, s · 391 unmodified lines | ||
| 392 | 392 | |
| 393 | 393 | static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out) |
| 394 | 394 | { |
| 395 | − ScaleContext *scale = link->dst->priv; | |
| 396 | − AVFilterLink *outlink = link->dst->outputs[0]; | |
| 395 | + AVFilterContext *ctx = link->dst; | |
| 396 | + ScaleContext *scale = ctx->priv; | |
| 397 | + AVFilterLink *outlink = ctx->outputs[0]; | |
| 397 | 398 | AVFrame *out; |
| 398 | 399 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); |
| 399 | 400 | char buf[32]; |
| @@ -410,7 +411,9 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out) · 10 unmodified lines | ||
| 410 | 411 | in->sample_aspect_ratio.den != link->sample_aspect_ratio.den || |
| 411 | 412 | in->sample_aspect_ratio.num != link->sample_aspect_ratio.num; |
| 412 | 413 | |
| 413 | − if (frame_changed) { | |
| 414 | + if (frame_changed || | |
| 415 | + (scale->eval_mode == EVAL_MODE_FRAME && | |
| 416 | + ctx->filter == &ff_vf_scale2ref) ) { | |
| 414 | 417 | int ret; |
| 415 | 418 | |
| 416 | 419 | if (scale->eval_mode == EVAL_MODE_INIT) { |
| @@ -538,6 +541,23 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) · 121 unmodified lines | ||
| 538 | 541 | static int filter_frame_ref(AVFilterLink *link, AVFrame *in) |
| 539 | 542 | { |
| 540 | 543 | AVFilterLink *outlink = link->dst->outputs[1]; |
| 544 | + int frame_changed; | |
| 545 | + | |
| 546 | + frame_changed = in->width != link->w || | |
| 547 | + in->height != link->h || | |
| 548 | + in->format != link->format || | |
| 549 | + in->sample_aspect_ratio.den != link->sample_aspect_ratio.den || | |
| 550 | + in->sample_aspect_ratio.num != link->sample_aspect_ratio.num; | |
| 551 | + | |
| 552 | + if (frame_changed) { | |
| 553 | + link->format = in->format; | |
| 554 | + link->w = in->width; | |
| 555 | + link->h = in->height; | |
| 556 | + link->sample_aspect_ratio.num = in->sample_aspect_ratio.num; | |
| 557 | + link->sample_aspect_ratio.den = in->sample_aspect_ratio.den; | |
| 558 | + | |
| 559 | + config_props_ref(outlink); | |
| 560 | + } | |
| 541 | 561 | |
| 542 | 562 | return ff_filter_frame(outlink, in); |
| 543 | 563 | } |