summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-22 14:48:51 +0200
committerwm4 <wm4@nowhere>2013-07-22 15:11:04 +0200
commita48f7a546c8044decfd68409663530d6e9d06a14 (patch)
tree367b1c1404f37a9af5ba9b6a0610a571cfdf8090
parentb3dff290010e2afa2ad42fa1334a368d102cd79d (diff)
downloadmpv-a48f7a546c8044decfd68409663530d6e9d06a14.tar.bz2
mpv-a48f7a546c8044decfd68409663530d6e9d06a14.tar.xz
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.
-rw-r--r--core/av_log.c9
1 files 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);
}