[FFmpeg-devel] [PATCH] In video_thread(), disable logging of rescaled timestamps if DEBUG is not enabled.

Diego Biurrun diego
Sat Jan 29 11:46:45 CET 2011


On Sat, Jan 29, 2011 at 11:36:50AM +0100, Stefano Sabatini wrote:
> On date Thursday 2011-01-27 07:46:50 +0100, Diego Biurrun encoded:
> > On Thu, Jan 27, 2011 at 01:01:24AM +0100, Stefano Sabatini wrote:
> > > Avoid debug log spamming with -loglevel debug when the user is not
> > > debugging that code.
> > > 
> > > --- a/ffplay.c
> > > +++ b/ffplay.c
> > > @@ -1856,12 +1857,14 @@ static int video_thread(void *arg)
> > >  
> > >          if (av_cmp_q(tb, is->video_st->time_base)) {
> > > -            int64_t pts1 = pts_int;
> > > +            av_unused int64_t pts1 = pts_int;
> > >              pts_int = av_rescale_q(pts_int, tb, is->video_st->time_base);
> > > +#ifdef DEBUG
> > >              av_log(NULL, AV_LOG_DEBUG, "video_thread(): "
> > >                     "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n",
> > >                     tb.num, tb.den, pts1,
> > >                     is->video_st->time_base.num, is->video_st->time_base.den, pts_int);
> > > +#endif
> > 
> > dprintf
> > 
> > And if you move the function call into the av_log, you skip it in the
> > non-debug case and can avoid the av_unused I think.
> 
> dprintf is an internal symbol, so I don't know if it is a good idea to
> expose it in application code.

IIRC (but I may well be wrong) the ff* tools do use internal symbols in
other places.  Another option is to make the symbol or some variant of
it public.

> Also it conflicts with the dprintf defined in stdio.h.

This is of course bad, but such a name clash should be addressed in
FFmpeg anyway.  We can just rename it to dbg_printf, ff_dprintf or
similar.

Diego



More information about the ffmpeg-devel mailing list