[FFmpeg-devel] [PATCH 1/2] avutil/log: Add av_log_once() for printing a message just once per instance
Anton Khirnov
anton at khirnov.net
Tue Jan 21 20:44:46 EET 2020
Quoting Michael Niedermayer (2020-01-21 15:43:48)
> On Tue, Jan 21, 2020 at 12:24:50PM +0100, Anton Khirnov wrote:
> > Quoting Michael Niedermayer (2020-01-16 17:51:28)
> > > Compared to ad-hoc if(printed) ... code this allows the user to disable
> > > it with a flag and see all repeated messages, it is also simpler
> >
> > That flag is global state - it should be deprecated and removed, not
> > embedded further into the API.
>
> When the flag is replaced by a non global solution every of its uses
> would be replaced too.
>
> Until such a non global API exists, this is the only way the user can
> indicate her choice of which log messages to print.
> Code should honor the existing API and user preferrance.
The problem is that right now, flags is only used by the default log
callback. The behaviour of the default log callback is not specified by
the API, so it can be changed later without much trouble. With this
patch, the function of flags is hardcoded into the API, making its
future removal significantly harder.
--
Anton Khirnov
More information about the ffmpeg-devel
mailing list