aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2010-05-19 22:51:38 +0000
committerMichael Niedermayer <michaelni@gmx.at>2010-05-19 22:51:38 +0000
commit4880cfd9522fcb0234aacc4e40f0f27729ccee40 (patch)
tree1a43adb1e7343d7f8694abb34389a270ac38ebd9
parent2c1bb26535b7c5476bc5cee4bd4c8f0fdadd1f27 (diff)
downloadffmpeg-4880cfd9522fcb0234aacc4e40f0f27729ccee40.tar.gz
Print parent log context too, if available.
Originally committed as revision 23200 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavutil/log.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libavutil/log.c b/libavutil/log.c
index 87a1edaffb..ce0dc4aa52 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -68,11 +68,17 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
if(level>av_log_level)
return;
+ line[0]=0;
#undef fprintf
if(print_prefix && avc) {
- snprintf(line, sizeof(line), "[%s @ %p]", avc->item_name(ptr), ptr);
- }else
- line[0]=0;
+ if(avc->version >= (50<<16 | 15<<8 | 3) && avc->parent_log_context_offset){
+ AVClass** parent= *(AVClass***)(((uint8_t*)ptr) + avc->parent_log_context_offset);
+ if(parent && *parent){
+ snprintf(line, sizeof(line), "[%s @ %p]", (*parent)->item_name(parent), parent);
+ }
+ }
+ snprintf(line + strlen(line), sizeof(line) - strlen(line), "[%s @ %p]", avc->item_name(ptr), ptr);
+ }
vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl);