summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2010-05-08 20:41:20 +0000
committerMichael Niedermayer <michaelni@gmx.at>2010-05-08 20:41:20 +0000
commit3fe1ec39c6eeba3348e3824df0d185525c321d57 (patch)
treeb3adbecf0ab4d8158bc9b7a9e7e6c7a5046aaab2
parentc12caa32b2d9fd8f76b4268a835731935b1cd794 (diff)
Add means to adjust the log level per context.
Originally committed as revision 23059 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavutil/avutil.h2
-rw-r--r--libavutil/log.c3
-rw-r--r--libavutil/log.h6
3 files changed, 10 insertions, 1 deletions
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index e9e07b92fd..4bfe024f6e 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -41,7 +41,7 @@
#define LIBAVUTIL_VERSION_MAJOR 50
#define LIBAVUTIL_VERSION_MINOR 15
-#define LIBAVUTIL_VERSION_MICRO 1
+#define LIBAVUTIL_VERSION_MICRO 2
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
diff --git a/libavutil/log.c b/libavutil/log.c
index 9a8b66ee4d..547287fc29 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -89,8 +89,11 @@ static void (*av_log_callback)(void*, int, const char*, va_list) = av_log_defaul
void av_log(void* avcl, int level, const char *fmt, ...)
{
+ AVClass* avc= avcl ? *(AVClass**)avcl : NULL;
va_list vl;
va_start(vl, fmt);
+ if(avc && avc->version >= (50<<16 | 15<<8 | 2) && avc->log_level_offset_offset && level>=AV_LOG_FATAL)
+ level += *(int*)(((uint8_t*)avcl) + avc->log_level_offset_offset);
av_vlog(avcl, level, fmt, vl);
va_end(vl);
}
diff --git a/libavutil/log.h b/libavutil/log.h
index 1c3e490139..d4bc7554b3 100644
--- a/libavutil/log.h
+++ b/libavutil/log.h
@@ -56,6 +56,12 @@ typedef struct {
*/
int version;
+
+ /**
+ * Offset in the structure where log_level_offset is stored.
+ * 0 means there is no such variable
+ */
+ int log_level_offset_offset;
} AVClass;
/* av_log API */