[vlc-commits] libass: add message callback
Grigori Goronzy
git at videolan.org
Mon Aug 22 15:04:12 CEST 2011
vlc | branch: master | Grigori Goronzy <greg at blackbox> | Sat Aug 20 20:15:34 2011 +0200| [3e6913a3f4a5496bb44435cc0dc0c9eacdb71a28] | committer: Jean-Baptiste Kempf
libass: add message callback
Add a message callback function to get libass messages into VLC's
logging system.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3e6913a3f4a5496bb44435cc0dc0c9eacdb71a28
---
modules/codec/libass.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/modules/codec/libass.c b/modules/codec/libass.c
index 3ad9512..829e1fe 100644
--- a/modules/codec/libass.c
+++ b/modules/codec/libass.c
@@ -120,6 +120,23 @@ static void RegionDraw( subpicture_region_t *p_region, ASS_Image *p_img );
//#define DEBUG_REGION
+static void MessageCallback( int level, const char *fmt, va_list args, void *data )
+{
+ decoder_t *p_dec = (decoder_t *)data;
+
+ // translate verbosity level
+ if( level > 6 )
+ return;
+ else if( level > 4 )
+ level = VLC_MSG_DBG;
+ else if( level > 1 )
+ level = VLC_MSG_WARN;
+ else
+ level = VLC_MSG_ERR;
+
+ msg_GenericVa( p_dec, level, MODULE_STRING, fmt, args );
+}
+
/*****************************************************************************
* Create: Open libass decoder.
*****************************************************************************/
@@ -155,6 +172,9 @@ static int Create( vlc_object_t *p_this )
return VLC_EGENERIC;
}
+ /* Add message callback for logging */
+ ass_set_message_cb( p_sys->p_library, MessageCallback, p_dec );
+
/* load attachments */
input_attachment_t **pp_attachments;
int i_attachments;
More information about the vlc-commits
mailing list