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

Submitted by Nicolas George on Sept. 7, 2017, 7:42 a.m.

Details

Message ID 20170907074226.7273-4-george@nsup.org
State New
Headers show

Commit Message

Nicolas George Sept. 7, 2017, 7:42 a.m.
Signed-off-by: Nicolas George <george@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.

Comments

Paul B Mahol Sept. 7, 2017, 2:16 p.m.
On 9/7/17, Nicolas George <george@nsup.org> wrote:
> Signed-off-by: Nicolas George <george@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.

Breaks duration expression.
Nicolas George Sept. 7, 2017, 2:27 p.m.
Le primidi 21 fructidor, an CCXXV, Paul B Mahol a écrit :
> > 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.
> Breaks duration expression.

I do not see how it could be, as the filter currently does not work at
all.

If you cannot be convinced to be less terse, I will not touch it again,
please fix it yourself.

Regards,
Paul B Mahol Sept. 7, 2017, 2:32 p.m.
On 9/7/17, Nicolas George <george@nsup.org> wrote:
> Le primidi 21 fructidor, an CCXXV, Paul B Mahol a ecrit :
>> > 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.
>> Breaks duration expression.
>
> I do not see how it could be, as the filter currently does not work at
> all.

Works here, you will need to be more verbose.

>
> If you cannot be convinced to be less terse, I will not touch it again,
> please fix it yourself.

Duration expressions says by how much frames filter will spend on
zooming current
input frame.
Nicolas George Sept. 7, 2017, 2:33 p.m.
Le primidi 21 fructidor, an CCXXV, Paul B Mahol a écrit :
> Works here, you will need to be more verbose.

./ffmpeg_g -lavfi testsrc2,zoompan -f framecrc -

begs to differ.

Regards,
Paul B Mahol Sept. 7, 2017, 2:38 p.m.
On 9/7/17, Nicolas George <george@nsup.org> wrote:
> Le primidi 21 fructidor, an CCXXV, Paul B Mahol a ecrit :
>> Works here, you will need to be more verbose.
>
> ./ffmpeg_g -lavfi testsrc2,zoompan -f framecrc -

Lavd bug. Normal -vf approach works.
Nicolas George Sept. 7, 2017, 2:40 p.m.
Le primidi 21 fructidor, an CCXXV, Paul B Mahol a écrit :
> > ./ffmpeg_g -lavfi testsrc2,zoompan -f framecrc -
> Lavd bug.

Read again, this is not using lavd at all. And it should work. The fact
that it does not is definitely a zoompan bug.

Regards,

Patch hide | download patch | download mbox

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)