[FFmpeg-cvslog] avfilter/vf_zoompan: fix pzoom usage

Paul B Mahol git at videolan.org
Mon Aug 15 11:00:13 EEST 2016


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Aug 15 09:31:09 2016 +0200| [ac18114b96fb59056d78b00b73b991007cd7bcd2] | committer: Paul B Mahol

avfilter/vf_zoompan: fix pzoom usage

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ac18114b96fb59056d78b00b73b991007cd7bcd2
---

 libavfilter/vf_zoompan.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_zoompan.c b/libavfilter/vf_zoompan.c
index 471e143..7a71503 100644
--- a/libavfilter/vf_zoompan.c
+++ b/libavfilter/vf_zoompan.c
@@ -143,6 +143,10 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va
     int px[4], py[4];
     AVFrame *out;
 
+    var_values[VAR_PX]    = s->x;
+    var_values[VAR_PY]    = s->y;
+    var_values[VAR_PZOOM] = s->prev_zoom;
+    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 + 1;
@@ -265,7 +269,7 @@ static int request_frame(AVFilterLink *outlink)
     AVFilterContext *ctx = outlink->src;
     ZPContext *s = ctx->priv;
     AVFrame *in = s->in;
-    double zoom=1, dx=0, dy=0;
+    double zoom=-1, dx=-1, dy=-1;
     int ret = -1;
 
     if (in) {
@@ -276,9 +280,12 @@ static int request_frame(AVFilterLink *outlink)
     }
 
     if (s->current_frame >= s->nb_frames) {
-        s->x = dx;
-        s->y = dy;
-        s->prev_zoom = zoom;
+        if (dx != -1)
+            s->x = dx;
+        if (dy != -1)
+            s->y = dy;
+        if (zoom != -1)
+            s->prev_zoom = zoom;
         s->prev_nb_frames = s->nb_frames;
         s->nb_frames = 0;
         s->current_frame = 0;



More information about the ffmpeg-cvslog mailing list