[FFmpeg-cvslog] r25117 - trunk/libavutil/log.c

Michael Niedermayer michaelni
Tue Sep 14 11:54:45 CEST 2010


On Tue, Sep 14, 2010 at 08:14:12AM +0100, M?ns Rullg?rd wrote:
> Ramiro Polla <ramiro.polla at gmail.com> writes:
> 
> > On Mon, Sep 13, 2010 at 10:02 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> >> On Tue, Sep 14, 2010 at 01:28:19AM +0100, M?ns Rullg?rd wrote:
> >>> michael <subversion at mplayerhq.hu> writes:
> >>>
> >>> > Author: michael
> >>> > Date: Tue Sep 14 02:17:58 2010
> >>> > New Revision: 25117
> >>> >
> >>> > Log:
> >>> > Limit av_log repeat detection to terminals so as to avoid filling files with
> >>> > lots of mess.
> >>> >
> >>> > Modified:
> >>> > ? ?trunk/libavutil/log.c
> >>> >
> >>> > Modified: trunk/libavutil/log.c
> >>> > ==============================================================================
> >>> > --- trunk/libavutil/log.c ? Tue Sep 14 00:09:28 2010 ? ? ? ?(r25116)
> >>> > +++ trunk/libavutil/log.c ? Tue Sep 14 02:17:58 2010 ? ? ? ?(r25117)
> >>> > @@ -85,6 +85,7 @@ void av_log_default_callback(void* ptr,
> >>> > ? ? ?static int print_prefix=1;
> >>> > ? ? ?static int count;
> >>> > ? ? ?static char line[1024], prev[1024];
> >>> > + ? ?static int detect_repeats;
> >>> > ? ? ?AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
> >>> > ? ? ?if(level>av_log_level)
> >>> > ? ? ? ? ?return;
> >>> > @@ -103,7 +104,12 @@ void av_log_default_callback(void* ptr,
> >>> > ? ? ?vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl);
> >>> >
> >>> > ? ? ?print_prefix= line[strlen(line)-1] == '\n';
> >>> > - ? ?if(print_prefix && !strcmp(line, prev)){
> >>> > +
> >>> > +#if HAVE_ISATTY
> >>> > + ? ?if(!detect_repeats) detect_repeats= isatty(2) ? 1 : -1;
> >>> > +#endif
> >>> > +
> >>> > + ? ?if(print_prefix && detect_repeats==1 && !strcmp(line, prev)){
> >>> > ? ? ? ? ?count++;
> >>> > ? ? ? ? ?fprintf(stderr, " ? ?Last message repeated %d times\r", count);
> >>>
> >>> This disables the repeat detection entirely for non-terminals. ?I want
> >>> the behaviour immediately before r24573. ?I don't care about whatever
> >>> that commit was supposed to fix.
> >>
> >> This revissions behavior had problems.
> 
> What problems.  I saw none.

ffmpeg | grep X | wc did not work
and the last message was missing its repeat line and value thus one did not
know for example if there was just 1 frame with an error or all frames with
that error if no other messages where printed


> 
> >> And noone else expressed a wish toward that revission instead of
> >> head.
> 
> So instead you decided to break it even more.

i fixed the problems, it maybe is not behaving the way you like it but it
is at least working and not loosing messages.


> 
> > IMO attached patch is a better behavior.
> >
> > Index: libavutil/log.c
> > ===================================================================
> > --- libavutil/log.c	(revision 25117)
> > +++ libavutil/log.c	(working copy)
> > @@ -109,8 +109,9 @@
> >      if(!detect_repeats) detect_repeats= isatty(2) ? 1 : -1;
> >  #endif
> >  
> > -    if(print_prefix && detect_repeats==1 && !strcmp(line, prev)){
> > +    if(print_prefix && !strcmp(line, prev)){
> >          count++;
> > +        if (detect_repeats == 1)
> >          fprintf(stderr, "    Last message repeated %d times\r", count);
> >          return;
> >      }
> 
> Yes, that is much better.

thats just reintroducing the bugs

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20100914/f7ddbe2d/attachment.pgp>



More information about the ffmpeg-cvslog mailing list