[FFmpeg-devel] [PATCH 4/8] lavfi/vf_zoompan: fix scheduling logic.

Nicolas George george at nsup.org
Thu Sep 7 10:42:22 EEST 2017


Signed-off-by: Nicolas George <george at nsup.org>
---
 libavfilter/vf_zoompan.c | 36 +++++++++---------------------------
 1 file changed, 9 insertions(+), 27 deletions(-)


I do not have the faintest idea what the output of this filter is supposed
to look like, so testing is limited. But at least now it outputs something.


diff --git a/libavfilter/vf_zoompan.c b/libavfilter/vf_zoompan.c
index 14d0a1707b..b1ade33b1f 100644
--- a/libavfilter/vf_zoompan.c
+++ b/libavfilter/vf_zoompan.c
@@ -95,7 +95,6 @@ typedef struct ZPcontext {
     double var_values[VARS_NB];
     int nb_frames;
     int current_frame;
-    int finished;
     AVRational framerate;
 } ZPContext;
 
@@ -240,7 +239,6 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va
         s->nb_frames = 0;
         s->current_frame = 0;
         av_frame_free(&s->in);
-        s->finished = 1;
     }
     return ret;
 error:
@@ -253,22 +251,12 @@ static int activate(AVFilterContext *ctx)
     ZPContext *s = ctx->priv;
     AVFilterLink *inlink = ctx->inputs[0];
     AVFilterLink *outlink = ctx->outputs[0];
-    int status, ret = 0;
-    int64_t pts;
-
-    if (s->in && ff_outlink_frame_wanted(outlink)) {
-        double zoom = -1, dx = -1, dy = -1;
-
-        ret = output_single_frame(ctx, s->in, s->var_values, s->current_frame,
-                                  &zoom, &dx, &dy);
-        if (ret < 0)
-            return ret;
-    }
+    int ret = 0;
 
+    FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
     if (!s->in && (ret = ff_inlink_consume_frame(inlink, &s->in)) > 0) {
-        double zoom = -1, dx = -1, dy = -1, nb_frames;
+        double nb_frames;
 
-        s->finished = 0;
         s->var_values[VAR_IN_W]  = s->var_values[VAR_IW] = s->in->width;
         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;
@@ -297,22 +285,16 @@ static int activate(AVFilterContext *ctx)
         }
 
         s->var_values[VAR_DURATION] = s->nb_frames = nb_frames;
-
+    }
+    if (s->in) {
+        double zoom = -1, dx = -1, dy = -1;
         ret = output_single_frame(ctx, s->in, s->var_values, s->current_frame,
                                   &zoom, &dx, &dy);
-        if (ret < 0)
-            return ret;
-    }
-    if (ret < 0) {
         return ret;
-    } else if (s->finished && ff_inlink_acknowledge_status(inlink, &status, &pts)) {
-        ff_outlink_set_status(outlink, status, pts);
-        return 0;
-    } else {
-        if (ff_outlink_frame_wanted(outlink) && s->finished)
-            ff_inlink_request_frame(inlink);
-        return 0;
     }
+    FF_FILTER_FORWARD_STATUS(inlink, outlink);
+    FF_FILTER_FORWARD_WANTED(outlink, inlink);
+    return 0;
 }
 
 static int query_formats(AVFilterContext *ctx)
-- 
2.14.1



More information about the ffmpeg-devel mailing list