diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-01-16 16:34:07 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-02-12 10:25:25 +0100 |
commit | 3182114f8815cb3324dd300d8254ecdb07dbe097 (patch) | |
tree | cfd25373619b9cd168cd2bbd59c86a92a4c8fd84 /libavutil/log.h | |
parent | f15007afa90a3eb3639848d9702c1cc3ac3e896b (diff) | |
download | ffmpeg-3182114f8815cb3324dd300d8254ecdb07dbe097.tar.gz |
avutil/log: Add av_log_once() for printing a message just once with a high log level
Compared to ad-hoc if(printed) ... code this allows the user to disable
it by adjusting the log level
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavutil/log.h')
-rw-r--r-- | libavutil/log.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libavutil/log.h b/libavutil/log.h index d9554e609d..9c14188a9c 100644 --- a/libavutil/log.h +++ b/libavutil/log.h @@ -233,6 +233,27 @@ typedef struct AVClass { */ void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); +/** + * Send the specified message to the log once with the initial_level and then with + * the subsequent_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different logging callback + * function. + * @see av_log + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct or NULL if general log. + * @param initial_level importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant" for the first occurance. + * @param subsequent_level importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant" after the first occurance. + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @param state a variable to keep trak of if a message has already been printed + * this must be initialized to 0 before the first use. The same state + * must not be accessed by 2 Threads simultaneously. + */ +void av_log_once(void* avcl, int initial_level, int subsequent_level, int *state, const char *fmt, ...) av_printf_format(5, 6); + /** * Send the specified message to the log if the level is less than or equal |