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.
This commit is contained in:
wm4 2013-07-22 14:48:51 +02:00
parent b3dff29001
commit a48f7a546c
1 changed files with 7 additions and 2 deletions

View File

@ -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);
}