Commit 3e6913a3 authored by Grigori Goronzy's avatar Grigori Goronzy Committed by Jean-Baptiste Kempf

libass: add message callback

Add a message callback function to get libass messages into VLC's
logging system.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 9c24da18
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment