[FFmpeg-devel] [PATCH] av_log repeating
Michael Niedermayer
michaelni
Tue Sep 14 00:08:26 CEST 2010
Hi
patch below disabled the (hated by some) repeating in av_log() and adds an
option for apps to turn it on again
comments?
(yes ill bump vers & add appchanges entry if people agree to this)
alternatively we can also completely drop the repeat code ...
Index: libavutil/log.c
===================================================================
--- libavutil/log.c (revision 25082)
+++ libavutil/log.c (working copy)
@@ -33,6 +33,7 @@
static
#endif
int av_log_level = AV_LOG_INFO;
+static int flags;
#if defined(_WIN32) && !defined(__MINGW32CE__)
#include <windows.h>
@@ -103,7 +104,7 @@
vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl);
print_prefix= line[strlen(line)-1] == '\n';
- if(print_prefix && !strcmp(line, prev)){
+ if(print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev)){
count++;
fprintf(stderr, " Last message repeated %d times\r", count);
return;
@@ -144,6 +145,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;
Index: libavutil/log.h
===================================================================
--- libavutil/log.h (revision 25082)
+++ libavutil/log.h (working copy)
@@ -135,4 +135,7 @@
void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl);
const char* av_default_item_name(void* ctx);
+#define AV_LOG_SKIP_REPEATED 1 ///< Skip repeated messages, this requires the output to support "\r"
+void av_log_set_flags(int arg);
+
#endif /* AVUTIL_LOG_H */
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- 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-devel/attachments/20100914/9571103a/attachment.pgp>
More information about the ffmpeg-devel
mailing list