Commit 6c52c72b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Store the object type name rather than object type ID within log messages.

This remove the triplicated id to name conversion and saves many lookups.
It also removes the obnoxious "private" messages.
parent 7b7d2516
......@@ -59,7 +59,7 @@ typedef struct
{
int i_type; /**< message type, see below */
int i_object_id;
int i_object_type;
const char *psz_object_type;
char * psz_module;
char * psz_msg; /**< the message itself */
char * psz_header; /**< Additional header */
......@@ -161,8 +161,6 @@ void __msg_Destroy ( vlc_object_t * );
VLC_EXPORT( msg_subscription_t*, __msg_Subscribe, ( vlc_object_t *, int ) );
VLC_EXPORT( void, __msg_Unsubscribe, ( vlc_object_t *, msg_subscription_t * ) );
VLC_EXPORT(const char *, msg_GetObjectTypeName, (int i_object_type ));
/**
* @}
*/
......
......@@ -54,7 +54,7 @@ void MessagesView::Pulse()
}
int i_start, oldLength;
char * psz_module_type = NULL;
const char * psz_module_type = NULL;
rgb_color red = { 200, 0, 0 };
rgb_color gray = { 150, 150, 150 };
rgb_color green = { 0, 150, 0 };
......@@ -80,20 +80,7 @@ void MessagesView::Pulse()
case VLC_MSG_DBG: color = gray; break;
}
switch( p_sub->p_msg[i_start].i_object_type )
{
case VLC_OBJECT_ROOT: psz_module_type = "root"; break;
case VLC_OBJECT_VLC: psz_module_type = "vlc"; break;
case VLC_OBJECT_MODULE: psz_module_type = "module"; break;
case VLC_OBJECT_INTF: psz_module_type = "interface"; break;
case VLC_OBJECT_PLAYLIST: psz_module_type = "playlist"; break;
case VLC_OBJECT_ITEM: psz_module_type = "item"; break;
case VLC_OBJECT_INPUT: psz_module_type = "input"; break;
case VLC_OBJECT_DECODER: psz_module_type = "decoder"; break;
case VLC_OBJECT_VOUT: psz_module_type = "video output"; break;
case VLC_OBJECT_AOUT: psz_module_type = "audio output"; break;
case VLC_OBJECT_SOUT: psz_module_type = "stream output"; break;
}
psz_module_type = p_sub->p_msg[i_start].psz_object_type;
if( LockLooper() )
{
......
......@@ -172,7 +172,7 @@ libvlc_log_message_t *libvlc_log_iterator_next( libvlc_log_iterator_t *p_iter,
vlc_mutex_lock(p_iter->p_messages->p_lock);
msg = p_iter->p_messages->p_msg+i_pos;
buffer->i_severity = msg->i_type;
buffer->psz_type = msg_GetObjectTypeName(msg->i_object_type);
buffer->psz_type = msg->psz_object_type;
buffer->psz_name = msg->psz_module;
buffer->psz_header = msg->psz_header;
buffer->psz_message = msg->psz_msg;
......
......@@ -173,7 +173,6 @@ __msg_Dbg
__msg_Err
__msg_Generic
__msg_GenericVa
msg_GetObjectTypeName
__msg_Info
__msg_Subscribe
__msg_Unsubscribe
......
......@@ -197,35 +197,6 @@ void __msg_Unsubscribe( vlc_object_t *p_this, msg_subscription_t *p_sub )
UNLOCK_BANK;
}
const char *msg_GetObjectTypeName(int i_object_type )
{
switch( i_object_type )
{
case VLC_OBJECT_GLOBAL: return "global";
case VLC_OBJECT_LIBVLC: return "libvlc";
case VLC_OBJECT_MODULE: return "module";
case VLC_OBJECT_INTF: return "interface";
case VLC_OBJECT_PLAYLIST: return "playlist";
case VLC_OBJECT_ITEM: return "item";
case VLC_OBJECT_INPUT: return "input";
case VLC_OBJECT_DECODER: return "decoder";
case VLC_OBJECT_PACKETIZER: return "packetizer";
case VLC_OBJECT_ENCODER: return "encoder";
case VLC_OBJECT_VOUT: return "video output";
case VLC_OBJECT_AOUT: return "audio output";
case VLC_OBJECT_SOUT: return "stream output";
case VLC_OBJECT_HTTPD: return "http server";
case VLC_OBJECT_HTTPD_HOST: return "http server";
case VLC_OBJECT_DIALOGS: return "dialogs provider";
case VLC_OBJECT_VLM: return "vlm";
case VLC_OBJECT_ANNOUNCE: return "announce handler";
case VLC_OBJECT_DEMUX: return "demuxer";
case VLC_OBJECT_ACCESS: return "access";
case VLC_OBJECT_META_ENGINE: return "meta engine";
default: return "private";
}
}
/*****************************************************************************
* __msg_*: print a message
*****************************************************************************
......@@ -479,7 +450,7 @@ static void QueueMsg( vlc_object_t *p_this, int i_queue, int i_type,
p_item->i_type = VLC_MSG_WARN;
p_item->i_object_id = p_this->i_object_id;
p_item->i_object_type = p_this->i_object_type;
p_item->psz_object_type = p_this->psz_object_type;
p_item->psz_module = strdup( "message" );
p_item->psz_msg = strdup( "message queue overflowed" );
p_item->psz_header = NULL;
......@@ -501,7 +472,7 @@ static void QueueMsg( vlc_object_t *p_this, int i_queue, int i_type,
/* Fill message information fields */
p_item->i_type = i_type;
p_item->i_object_id = p_this->i_object_id;
p_item->i_object_type = p_this->i_object_type;
p_item->psz_object_type = p_this->psz_object_type;
p_item->psz_module = strdup( psz_module );
p_item->psz_msg = psz_str;
p_item->psz_header = psz_header;
......@@ -603,7 +574,7 @@ static void PrintMsg ( vlc_object_t * p_this, msg_item_t * p_item )
break;
}
psz_object = msg_GetObjectTypeName(p_item->i_object_type);
psz_object = p_item->psz_object_type;
#ifdef UNDER_CE
# define CE_WRITE(str) WriteFile( QUEUE(MSG_QUEUE_NORMAL).logfile, \
......
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