# HG changeset patch # User michael # Date 1285342621 0 # Node ID 4a16166d580e52b087763c4d4b0e2c5ceb3c10ab # Parent 61cb1c0a6eb60fae5e771def6095d6cfd562b806 2nd try to fix av_log() repeated detection diff -r 61cb1c0a6eb6 -r 4a16166d580e avutil.h --- a/avutil.h Tue Sep 14 14:45:43 2010 +0000 +++ b/avutil.h Fri Sep 24 15:37:01 2010 +0000 @@ -40,7 +40,7 @@ #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) #define LIBAVUTIL_VERSION_MAJOR 50 -#define LIBAVUTIL_VERSION_MINOR 27 +#define LIBAVUTIL_VERSION_MINOR 28 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff -r 61cb1c0a6eb6 -r 4a16166d580e log.c --- a/log.c Tue Sep 14 14:45:43 2010 +0000 +++ b/log.c Fri Sep 24 15:37:01 2010 +0000 @@ -33,6 +33,7 @@ static #endif int av_log_level = AV_LOG_INFO; +static int flags; #if defined(_WIN32) && !defined(__MINGW32CE__) #include @@ -109,8 +110,9 @@ if(!detect_repeats) detect_repeats= isatty(2) ? 1 : -1; #endif - if(print_prefix && detect_repeats==1 && !strcmp(line, prev)){ + if(print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev)){ count++; + if(detect_repeats==1) fprintf(stderr, " Last message repeated %d times\r", count); return; } @@ -150,6 +152,11 @@ av_log_level = level; } +void av_log_set_flags(int arg) +{ + flags= arg; +} + void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)) { av_log_callback = callback; diff -r 61cb1c0a6eb6 -r 4a16166d580e log.h --- a/log.h Tue Sep 14 14:45:43 2010 +0000 +++ b/log.h Fri Sep 24 15:37:01 2010 +0000 @@ -135,4 +135,15 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); const char* av_default_item_name(void* ctx); +/** + * Skip repeated messages, this requires the user app to use av_log() instead of + * (f)printf as the 2 would otherwise interfere and lead to + * "Last message repeated x times" messages below (f)printf messages with some + * bad luck. + * Also to receive the last, "last repeated" line if any, the user app must + * call av_log(NULL, AV_LOG_QUIET, ""); at the end + */ +#define AV_LOG_SKIP_REPEATED 1 +void av_log_set_flags(int arg); + #endif /* AVUTIL_LOG_H */