av_log: skip prefix if unknown

This happens with av_log(NULL, ...) calls. Drop the "?: " fallback
prefix, because it was confusing.

(Of course FFmpeg should not do this at all, but it's a very long way to
making the FFmpeg log callback sane.)
This commit is contained in:
wm4 2015-06-20 17:02:56 +02:00
parent 4e1159c3f2
commit 34fce974c6
1 changed files with 3 additions and 2 deletions

View File

@ -134,8 +134,9 @@ static void mp_msg_av_log_callback(void *ptr, int level, const char *fmt,
struct mp_log *log = get_av_log(ptr);
if (mp_msg_test(log, mp_level)) {
if (log_print_prefix)
mp_msg(log, mp_level, "%s: ", avc ? avc->item_name(ptr) : "?");
const char *prefix = avc ? avc->item_name(ptr) : NULL;
if (log_print_prefix && prefix)
mp_msg(log, mp_level, "%s: ", prefix);
log_print_prefix = fmt[strlen(fmt) - 1] == '\n';
mp_msg_va(log, mp_level, fmt, vl);