Pass libass messages to mp_msg
authorgreg <greg@b3059339-0415-0410-9bf9-f77b7e298cf2>
Mon, 19 Jul 2010 00:12:08 +0000 (00:12 +0000)
committergreg <greg@b3059339-0415-0410-9bf9-f77b7e298cf2>
Mon, 19 Jul 2010 00:12:08 +0000 (00:12 +0000)
git-svn-id: svn://git.mplayerhq.hu/mplayer/trunk@31755 b3059339-0415-0410-9bf9-f77b7e298cf2

libass/ass_mp.c

index f240251..7b245d9 100644 (file)
@@ -294,10 +294,26 @@ void ass_configure_fonts(ass_renderer_t* priv) {
        free(family);
 }
 
+static void message_callback(int level, const char *format, va_list va, void *ctx)
+{
+       int n;
+       char *str;
+       va_list dst;
+
+       va_copy(dst, va);
+       n = vsnprintf(NULL, 0, format, va);
+       if (n > 0 && (str = malloc(n + 1))) {
+               vsnprintf(str, n + 1, format, dst);
+               mp_msg(MSGT_ASS, level, "[ass] %s\n", str);
+               free(str);
+       }
+}
+
 ass_library_t* ass_init(void) {
        ass_library_t* priv;
        char* path = get_path("fonts");
        priv = ass_library_init();
+       ass_set_message_cb(priv, message_callback, NULL);
        ass_set_fonts_dir(priv, path);
        ass_set_extract_fonts(priv, extract_embedded_fonts);
        ass_set_style_overrides(priv, ass_force_style_list);