[FFmpeg-devel] [PATCH] lavf/concatdec: add timestamp log

Stefano Sabatini stefasab at gmail.com
Wed Nov 19 11:20:26 CET 2014


On date Tuesday 2014-11-18 20:26:04 +0100, Nicolas George encoded:
> L'octidi 28 brumaire, an CCXXIII, Stefano Sabatini a écrit :
> > Help debugging timestamp conversion issues.
> > ---
> >  libavformat/concatdec.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
> > index 2089883..f275bac 100644
> > --- a/libavformat/concatdec.c
> > +++ b/libavformat/concatdec.c
> > @@ -23,6 +23,7 @@
> >  #include "libavutil/intreadwrite.h"
> >  #include "libavutil/opt.h"
> >  #include "libavutil/parseutils.h"
> > +#include "libavutil/timestamp.h"
> >  #include "avformat.h"
> >  #include "internal.h"
> >  #include "url.h"
> > @@ -479,6 +480,7 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
> >      int ret;
> >      int64_t delta;
> >      ConcatStream *cs;
> > +    AVStream *st;
> >  
> >      while (1) {
> >          ret = av_read_frame(cat->avf, pkt);
> > @@ -504,6 +506,12 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
> >      if ((ret = filter_packet(avf, cs, pkt)))
> >          return ret;
> >  
> > +    st = cat->avf->streams[pkt->stream_index];
> 
> > +    av_log(avf, AV_LOG_DEBUG, "file:%li stream:%d pts:%s pts_time:%s dts:%s dts_time:%s",
> 
> IIRC, "%li" is wrong: the value is ptrdiff_t, the valid prefix is 't'.
> Except it will probably not work with microsoft's compiler... again. You can
> safely cast the value to unsigned, since nb_files has that type.
> 
> > +           cat->cur_file - cat->files, pkt->stream_index,
> > +           av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base),
> > +           av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base));
> > +
> >      delta = av_rescale_q(cat->cur_file->start_time - cat->avf->start_time,
> >                           AV_TIME_BASE_Q,
> >                           cat->avf->streams[pkt->stream_index]->time_base);
> > @@ -511,6 +519,9 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
> >          pkt->pts += delta;
> >      if (pkt->dts != AV_NOPTS_VALUE)
> >          pkt->dts += delta;
> > +    av_log(avf, AV_LOG_DEBUG, " -> pts:%s pts_time:%s dts:%s dts_time:%s\n",
> > +           av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base),
> > +           av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base));
> >      return ret;
> >  }
> 
> The rest LGTM.

Changed, pushed, thanks.
-- 
FFmpeg = Fanciful & Fast Multimedia Powered Exploitable Game


More information about the ffmpeg-devel mailing list