changeset 31689:c447fb125915

Pass libass messages to mp_msg
author greg
date Mon, 19 Jul 2010 00:12:08 +0000
parents 2b6a652aefbe
children f2d98fc0702c
files libass/ass_mp.c
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libass/ass_mp.c	Mon Jul 19 00:12:04 2010 +0000
+++ b/libass/ass_mp.c	Mon Jul 19 00:12:08 2010 +0000
@@ -294,10 +294,26 @@
 	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);