[FFmpeg-devel] [PATCH 2/2] lavfi/vf_zoompan: fix PTS logic.

Nicolas George george at nsup.org
Mon Dec 1 16:43:17 CET 2014


Fix non-monotonic output PTS when input PTS and duration
are set with compatible values.

Signed-off-by: Nicolas George <george at nsup.org>
---
 libavfilter/vf_zoompan.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavfilter/vf_zoompan.c b/libavfilter/vf_zoompan.c
index 1c97eb6..0713741 100644
--- a/libavfilter/vf_zoompan.c
+++ b/libavfilter/vf_zoompan.c
@@ -84,7 +84,6 @@ typedef struct ZPcontext {
     double prev_zoom;
     int prev_nb_frames;
     struct SwsContext *sws;
-    int64_t frame_count;
 } ZPContext;
 
 #define OFFSET(x) offsetof(ZPContext, x)
@@ -164,7 +163,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         int py[4];
         uint8_t *input[4];
         int64_t pts = av_rescale_q(in->pts, inlink->time_base,
-                                   outlink->time_base) + s->frame_count;
+                                   outlink->time_base) + i;
 
         var_values[VAR_TIME] = pts * av_q2d(outlink->time_base);
         var_values[VAR_FRAME] = i;
@@ -230,7 +229,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         sws_scale(s->sws, (const uint8_t *const *)&input, in->linesize, 0, h, out->data, out->linesize);
 
         out->pts = pts;
-        s->frame_count++;
 
         ret = ff_filter_frame(outlink, out);
         if (ret < 0)
-- 
2.1.3



More information about the ffmpeg-devel mailing list