[MPlayer-cvslog] r31755 - trunk/libass/ass_mp.c

greg subversion at mplayerhq.hu
Mon Jul 19 02:12:08 CEST 2010


Author: greg
Date: Mon Jul 19 02:12:08 2010
New Revision: 31755

Log:
Pass libass messages to mp_msg

Modified:
   trunk/libass/ass_mp.c

Modified: trunk/libass/ass_mp.c
==============================================================================
--- trunk/libass/ass_mp.c	Mon Jul 19 02:12:04 2010	(r31754)
+++ trunk/libass/ass_mp.c	Mon Jul 19 02:12:08 2010	(r31755)
@@ -294,10 +294,26 @@ void ass_configure_fonts(ass_renderer_t*
 	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);


More information about the MPlayer-cvslog mailing list