From 9a83d03c5d8d6f73fd41707eb9775be1af3d3daf Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 22 Jun 2013 20:31:19 +0200 Subject: 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.) --- core/av_log.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'core') 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); } -- cgit v1.2.3