showwaves: fix PTS computation.
authorNicolas George <nicolas.george@normalesup.org>
Sat, 23 Jun 2012 10:03:00 +0000 (12:03 +0200)
committerNicolas George <nicolas.george@normalesup.org>
Sat, 23 Jun 2012 13:08:23 +0000 (15:08 +0200)
libavfilter/avf_showwaves.c

index 90d3ec9..121f785 100644 (file)
@@ -202,7 +202,10 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
                                     outlink->w, outlink->h);
             outpicref->video->w = outlink->w;
             outpicref->video->h = outlink->h;
-            outpicref->pts = insamples->pts;
+            outpicref->pts = insamples->pts +
+                             av_rescale_q((p - (int16_t *)insamples->data[0]) / nb_channels,
+                                          (AVRational){ 1, inlink->sample_rate },
+                                          outlink->time_base);
             outlink->out_buf = outpicref;
             linesize = outpicref->linesize[0];
             memset(outpicref->data[0], 0, showwaves->h*linesize);