ass_mp.c: remap libass log levels

libass is way too chatty. The application using it shouldn't be forced
to print useless messages, especially not if the action was initiated
by the application, and libass successfully completes it.

Note that this might be a problem that should be fixed in libass, but
remapping the log levels is needed anyway (instead of relying on the
coincidence that the log level values are similar).
This commit is contained in:
wm4 2012-07-29 23:57:46 +02:00
parent bf3b3d138d
commit 69c13af381
1 changed files with 12 additions and 0 deletions

View File

@ -267,8 +267,20 @@ void mp_ass_configure_fonts(ASS_Renderer *priv)
free(family); free(family);
} }
static int map_ass_level[] = {
MSGL_ERR, // 0 "FATAL errors"
MSGL_WARN,
MSGL_INFO,
MSGL_V,
MSGL_V,
MSGL_V, // 5 application recommended level
MSGL_DBG2,
MSGL_DBG3, // 7 "verbose DEBUG"
};
static void message_callback(int level, const char *format, va_list va, void *ctx) static void message_callback(int level, const char *format, va_list va, void *ctx)
{ {
level = map_ass_level[level];
mp_msg(MSGT_ASS, level, "[ass] "); mp_msg(MSGT_ASS, level, "[ass] ");
mp_msg_va(MSGT_ASS, level, format, va); mp_msg_va(MSGT_ASS, level, format, va);
// libass messages lack trailing \n // libass messages lack trailing \n