X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Fvf_zoompan.c;h=59c9b19ec853491c811532b8d1c8f27d45a13deb;hb=61097535cdaa91fea0d62c567b3af02a940f6c2d;hp=0635171b57877d473287859ef3975e7e691ab514;hpb=b14761d1f8372dfe558193b8b754b9f1a858077d;p=ffmpeg diff --git a/libavfilter/vf_zoompan.c b/libavfilter/vf_zoompan.c index 0635171b578..59c9b19ec85 100644 --- a/libavfilter/vf_zoompan.c +++ b/libavfilter/vf_zoompan.c @@ -167,7 +167,7 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va var_values[VAR_PDURATION] = s->prev_nb_frames; var_values[VAR_TIME] = pts * av_q2d(outlink->time_base); var_values[VAR_FRAME] = i; - var_values[VAR_ON] = outlink->frame_count_in + 1; + var_values[VAR_ON] = outlink->frame_count_in; *zoom = av_expr_eval(s->zoom_expr, var_values, NULL); @@ -245,6 +245,8 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va } return ret; error: + sws_freeContext(s->sws); + s->sws = NULL; av_frame_free(&out); return ret; } @@ -257,6 +259,8 @@ static int activate(AVFilterContext *ctx) int status, ret = 0; int64_t pts; + FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); + if (s->in && ff_outlink_frame_wanted(outlink)) { double zoom = -1, dx = -1, dy = -1; @@ -274,8 +278,8 @@ static int activate(AVFilterContext *ctx) s->var_values[VAR_IN_H] = s->var_values[VAR_IH] = s->in->height; s->var_values[VAR_OUT_W] = s->var_values[VAR_OW] = s->w; s->var_values[VAR_OUT_H] = s->var_values[VAR_OH] = s->h; - s->var_values[VAR_IN] = inlink->frame_count_out + 1; - s->var_values[VAR_ON] = outlink->frame_count_in + 1; + s->var_values[VAR_IN] = inlink->frame_count_out - 1; + s->var_values[VAR_ON] = outlink->frame_count_in; s->var_values[VAR_PX] = s->x; s->var_values[VAR_PY] = s->y; s->var_values[VAR_X] = 0; @@ -344,6 +348,10 @@ static av_cold void uninit(AVFilterContext *ctx) sws_freeContext(s->sws); s->sws = NULL; + av_expr_free(s->x_expr); + av_expr_free(s->y_expr); + av_expr_free(s->zoom_expr); + av_frame_free(&s->in); } static const AVFilterPad inputs[] = {