From a48f7a546c8044decfd68409663530d6e9d06a14 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 22 Jul 2013 14:48:51 +0200 Subject: av_log: restore handling of prefixes and line breaks Commit 9a83d03 accidentally removed this. (Overlooked "static"?) The handling of this rather sucks. Maybe a better solution will be possible once we clean up the mp_msg code. --- core/av_log.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/av_log.c b/core/av_log.c index b6cae6f8f8..1331a1fb26 100644 --- a/core/av_log.c +++ b/core/av_log.c @@ -103,6 +103,8 @@ static int extract_msg_type_from_ctx(void *ptr) #define LIB_PREFIX "libav" #endif +static bool print_prefix = true; + static void mp_msg_av_log_callback(void *ptr, int level, const char *fmt, va_list vl) { @@ -113,8 +115,11 @@ static void mp_msg_av_log_callback(void *ptr, int level, const char *fmt, if (!mp_msg_test(type, mp_level)) return; - mp_msg(type, mp_level, "[%s/%s] ", LIB_PREFIX, - avc ? avc->item_name(ptr) : "?"); + if (print_prefix) { + mp_msg(type, mp_level, "[%s/%s] ", LIB_PREFIX, + avc ? avc->item_name(ptr) : "?"); + } + print_prefix = fmt[strlen(fmt) - 1] == '\n'; mp_msg_va(type, mp_level, fmt, vl); } -- cgit v1.2.3