summaryrefslogtreecommitdiffstats
path: root/core/av_log.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-22 20:31:19 +0200
committerwm4 <wm4@nowhere>2013-06-22 20:34:47 +0200
commit9a83d03c5d8d6f73fd41707eb9775be1af3d3daf (patch)
treef0ecf04e6214256ea271705c373d4efe88cd00f8 /core/av_log.c
parent97f38de07abcb41eff29f56d58d8e21c49b9ec0a (diff)
downloadmpv-9a83d03c5d8d6f73fd41707eb9775be1af3d3daf.tar.bz2
mpv-9a83d03c5d8d6f73fd41707eb9775be1af3d3daf.tar.xz
av_log: change how ffmpeg log messages are formatted
Don't print the ffmpeg context pointer as %p. This is usually useless and confusing. Prefix all messages with "ffmpeg" to make clear that ffmpeg is printing these messages, and not us. If libavcodec is from Libav, use "libav" as prefix instead. (In theory, FFmpeg/Libav libraries could be mixed, but I don't think that is actually possible in practice.)
Diffstat (limited to 'core/av_log.c')
-rw-r--r--core/av_log.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/core/av_log.c b/core/av_log.c
index 37c308be7a..b6cae6f8f8 100644
--- a/core/av_log.c
+++ b/core/av_log.c
@@ -97,10 +97,15 @@ static int extract_msg_type_from_ctx(void *ptr)
return MSGT_FIXME;
}
+#if LIBAVCODEC_VERSION_MICRO >= 100
+#define LIB_PREFIX "ffmpeg"
+#else
+#define LIB_PREFIX "libav"
+#endif
+
static void mp_msg_av_log_callback(void *ptr, int level, const char *fmt,
va_list vl)
{
- static bool print_prefix = 1;
AVClass *avc = ptr ? *(AVClass **)ptr : NULL;
int mp_level = av_log_level_to_mp_level(level);
int type = extract_msg_type_from_ctx(ptr);
@@ -108,9 +113,8 @@ static void mp_msg_av_log_callback(void *ptr, int level, const char *fmt,
if (!mp_msg_test(type, mp_level))
return;
- if (print_prefix && avc)
- mp_msg(type, mp_level, "[%s @ %p]", avc->item_name(ptr), avc);
- print_prefix = fmt[strlen(fmt) - 1] == '\n';
+ mp_msg(type, mp_level, "[%s/%s] ", LIB_PREFIX,
+ avc ? avc->item_name(ptr) : "?");
mp_msg_va(type, mp_level, fmt, vl);
}