lavfi/vf_scale: forward errors from swscale

This commit is contained in:
Anton Khirnov 2021-05-23 16:06:55 +02:00
parent 6d51d65fb9
commit a948e47960

View File

@ -655,6 +655,7 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out)
AVFrame *out;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
char buf[32];
int ret;
int in_range;
int frame_changed;
@ -669,7 +670,6 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out)
in->sample_aspect_ratio.num != link->sample_aspect_ratio.num;
if (scale->eval_mode == EVAL_MODE_FRAME || frame_changed) {
int ret;
unsigned vars_w[VARS_NB] = { 0 }, vars_h[VARS_NB] = { 0 };
av_expr_count_vars(scale->w_pexpr, vars_w, VARS_NB);
@ -791,8 +791,9 @@ scale:
INT_MAX);
if (scale->interlaced>0 || (scale->interlaced<0 && in->interlaced_frame)) {
scale_slice(scale, out, in, scale->isws[0], 0, (link->h+1)/2, 2, 0);
scale_slice(scale, out, in, scale->isws[1], 0, link->h /2, 2, 1);
ret = scale_slice(scale, out, in, scale->isws[0], 0, (link->h+1)/2, 2, 0);
if (ret >= 0)
ret = scale_slice(scale, out, in, scale->isws[1], 0, link->h /2, 2, 1);
} else if (scale->nb_slices) {
int i, slice_h, slice_start, slice_end = 0;
const int nb_slices = FFMIN(scale->nb_slices, link->h);
@ -800,14 +801,18 @@ scale:
slice_start = slice_end;
slice_end = (link->h * (i+1)) / nb_slices;
slice_h = slice_end - slice_start;
scale_slice(scale, out, in, scale->sws, slice_start, slice_h, 1, 0);
ret = scale_slice(scale, out, in, scale->sws, slice_start, slice_h, 1, 0);
if (ret < 0)
break;
}
} else {
scale_slice(scale, out, in, scale->sws, 0, link->h, 1, 0);
ret = scale_slice(scale, out, in, scale->sws, 0, link->h, 1, 0);
}
av_frame_free(&in);
return 0;
if (ret < 0)
av_frame_free(frame_out);
return ret;
}
static int filter_frame(AVFilterLink *link, AVFrame *in)