[FFmpeg-devel] [PATCH] Don't let error messages overwrite progress information
Tue Dec 7 23:17:25 CET 2010
On Wed, 27 Oct 2010 13:25:24 +0200, Michael Karcher wrote:
> [the constructive suggestion is in the last paragraph]
> Am Mittwoch, den 27.10.2010, 12:42 +0200 schrieb Michael Niedermayer:
> > > > Problem is that we dont want the status line to overwrite something else
> > > > so keep track of the last thing printed and add a \n as needed
> > > What about printing the \r at the beginning of the status message
> > > instead of at the end? For sucessive status outputs, either way works,
> > > but the cursor will be at the end of the status message so it won't be
> > > overwritten if something else is output after it.
> > The "last message repeated" stuff will still overwrite it
> Right. This is obviously a fundamental problem. The "last message
> repeated" stuff expects that the last thing output ist the previous
> "last message repeated" message. While the timer output of ffmpeg
> expects that the current line contains a previos timer value. We can't
> satisfy both assumptions at the same time.
> > and appending text after it wont look pretty
> While this is right, it seems like exactly what the use case that
> started this thread needed - a timestamp that indicates when the message
> was printed. If the message is appended to the timestamp, that's maybe
> ugly but conveys all required information - except if the last message
> repeated stuff interferes.
> If the use case of the thread starter is deemed important enough, every
> instance of a repeated message is to be shown seperately. Having each
> "Last message repeated %d times" appended to a timestamp on a different
> line would make that possible - but OTOH, the "Last message repeated %d
> times" is intended to be overwritten, so one can not output a newline
We could change this so that only the last "Last message repeated %d
times" message is printed. That one gets a newline appended.
> It looks like the output of the timestamp in ffmpeg.c and the default
> logging callback just don't go together. A probably right way to fix the
> stuff is to have a custom log callback in ffmpeg.c that handles printing
> error messages with timestamps in a consistent way (e.g. prefixing the
> current timestamp to log messages - which needs the timestamp (string)
> to be in a global variable for that).
Yes, I think this would be desirable. Without that, the error messages
aren't particularly useful - or at least not as useful as they could be.
For clarity, I completely agree that my initial proposal was just a
hack , not suitable to be committed. Prepending all error messages
with a timestamp or frame number would be much cleaner, but obviously it
requires some more work and knowledge of the ffmpeg code, which I do
not have. But I'll be happy to review and test patches.
 Writing this hack didn't shock me though, as
av_log_default_callback() is already quite hackish IMHO, my own code
did not really stand out ;)
More information about the ffmpeg-devel