[FFmpeg-devel] [PATCH] showwaves: fix PTS computation.

Stefano Sabatini stefasab at gmail.com
Sat Jun 23 14:59:22 CEST 2012


On date Saturday 2012-06-23 12:03:49 +0200, Nicolas George encoded:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavfilter/avf_showwaves.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c
> index 90d3ec9..121f785 100644
> --- a/libavfilter/avf_showwaves.c
> +++ b/libavfilter/avf_showwaves.c
> @@ -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);

Should be OK, considering that for this filter 1/inlink->sample_rate =
outlink->time_base maybe this can be simplified to:
insamples->pts + (p - (int16_t *)insamples->data[0]) / nb_channels;

Thanks.
-- 
FFmpeg = Fundamentalist and Fanciful Murdering Perennial EntanGlement


More information about the ffmpeg-devel mailing list