I prefer first patch, as it makes the code simpler and starting at 0
simplifies all arithmetic operations, but it makes a slight behaviour
change, so I also propose the second version. Note how the 1-indexed logic
makes the documentation for "on" awkward.

Regards,

-- 
  Nicolas George
From e6bce546af4041bd09eca9a0e66aa1c33426bd3e Mon Sep 17 00:00:00 2001
From: Nicolas George <geo...@nsup.org>
Date: Mon, 1 Dec 2014 16:16:07 +0100
Subject: [PATCH] lavfi/zoompan: fix frame count logic.

Signed-off-by: Nicolas George <geo...@nsup.org>
---
 doc/filters.texi         | 4 ++--
 libavfilter/vf_zoompan.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 8c16c7a..6d52966 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -9307,10 +9307,10 @@ Output width.
 Output height.
 
 @item in
-Input frame count.
+Input frame count, starting at 0.
 
 @item on
-Output frame count.
+Output frame count, starting at 0.
 
 @item x
 @item y
diff --git a/libavfilter/vf_zoompan.c b/libavfilter/vf_zoompan.c
index 8f179e6..f55095f 100644
--- a/libavfilter/vf_zoompan.c
+++ b/libavfilter/vf_zoompan.c
@@ -134,8 +134,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     var_values[VAR_IN_H]  = var_values[VAR_IH] = in->height;
     var_values[VAR_OUT_W] = var_values[VAR_OW] = s->w;
     var_values[VAR_OUT_H] = var_values[VAR_OH] = s->h;
-    var_values[VAR_IN]    = inlink->frame_count + 1;
-    var_values[VAR_ON]    = outlink->frame_count + 1;
+    var_values[VAR_IN]    = inlink->frame_count;
+    var_values[VAR_ON]    = outlink->frame_count;
     var_values[VAR_PX]    = s->x;
     var_values[VAR_PY]    = s->y;
     var_values[VAR_X]     = 0;
@@ -165,7 +165,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
         var_values[VAR_TIME] = pts * av_q2d(outlink->time_base);
         var_values[VAR_FRAME] = i;
-        var_values[VAR_ON] = outlink->frame_count + 1;
+        var_values[VAR_ON] = outlink->frame_count;
         if ((ret = av_expr_parse_and_eval(&zoom, s->zoom_expr_str,
                                           var_names, var_values,
                                           NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
-- 
2.1.3

From ff4c5488bdc167100af791cf9e232494c0b5b7f1 Mon Sep 17 00:00:00 2001
From: Nicolas George <geo...@nsup.org>
Date: Mon, 1 Dec 2014 16:16:07 +0100
Subject: [PATCH] lavfi/zoompan: clarify documentation about frame counts.

Signed-off-by: Nicolas George <geo...@nsup.org>
---
 doc/filters.texi | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 8c16c7a..84bf671 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -9307,10 +9307,12 @@ Output width.
 Output height.
 
 @item in
-Input frame count.
+Input frame count, including the current one.
 
 @item on
-Output frame count.
+Output frame count, including the current one except. For the @var{d}
+expression, this the frame count associated to the first output frame, even
+if the final result is 0.
 
 @item x
 @item y
-- 
2.1.3

Attachment: signature.asc
Description: Digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to