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

Remove message unused "queue" parameter

There is only one queue at the moment, and if someone wants multiple
queues, it's probably not a good idea to hard-code queues as integers.
parent 80ddb522
...@@ -66,9 +66,6 @@ typedef struct ...@@ -66,9 +66,6 @@ typedef struct
/** debug messages */ /** debug messages */
#define VLC_MSG_DBG 3 #define VLC_MSG_DBG 3
#define MSG_QUEUE_NORMAL 0
#define MSG_QUEUE_HTTPD_ACCESS 1
/** /**
* Used by interface plugins which subscribe to the message bank. * Used by interface plugins which subscribe to the message bank.
*/ */
...@@ -84,30 +81,30 @@ struct msg_subscription_t ...@@ -84,30 +81,30 @@ struct msg_subscription_t
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
VLC_EXPORT( void, __msg_Generic, ( vlc_object_t *, int, int, const char *, const char *, ... ) ATTRIBUTE_FORMAT( 5, 6 ) ); VLC_EXPORT( void, __msg_Generic, ( vlc_object_t *, int, const char *, const char *, ... ) ATTRIBUTE_FORMAT( 4, 5 ) );
VLC_EXPORT( void, __msg_GenericVa, ( vlc_object_t *, int, int, const char *, const char *, va_list args ) ); VLC_EXPORT( void, __msg_GenericVa, ( vlc_object_t *, int, const char *, const char *, va_list args ) );
#define msg_GenericVa(a, b, c, d, e,f) __msg_GenericVa(VLC_OBJECT(a), b, c, d, e,f) #define msg_GenericVa(a, b, c, d, e) __msg_GenericVa(VLC_OBJECT(a), b, c, d, e)
VLC_EXPORT( void, __msg_Info, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) ); VLC_EXPORT( void, __msg_Info, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) );
VLC_EXPORT( void, __msg_Err, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) ); VLC_EXPORT( void, __msg_Err, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) );
VLC_EXPORT( void, __msg_Warn, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) ); VLC_EXPORT( void, __msg_Warn, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) );
VLC_EXPORT( void, __msg_Dbg, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) ); VLC_EXPORT( void, __msg_Dbg, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) );
#define msg_Info( p_this, ... ) \ #define msg_Info( p_this, ... ) \
__msg_Generic( VLC_OBJECT(p_this), MSG_QUEUE_NORMAL, VLC_MSG_INFO, \ __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_INFO, \
MODULE_STRING, __VA_ARGS__ ) MODULE_STRING, __VA_ARGS__ )
#define msg_Err( p_this, ... ) \ #define msg_Err( p_this, ... ) \
__msg_Generic( VLC_OBJECT(p_this), MSG_QUEUE_NORMAL, VLC_MSG_ERR, \ __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_ERR, \
MODULE_STRING, __VA_ARGS__ ) MODULE_STRING, __VA_ARGS__ )
#define msg_Warn( p_this, ... ) \ #define msg_Warn( p_this, ... ) \
__msg_Generic( VLC_OBJECT(p_this), MSG_QUEUE_NORMAL, VLC_MSG_WARN, \ __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_WARN, \
MODULE_STRING, __VA_ARGS__ ) MODULE_STRING, __VA_ARGS__ )
#define msg_Dbg( p_this, ... ) \ #define msg_Dbg( p_this, ... ) \
__msg_Generic( VLC_OBJECT(p_this), MSG_QUEUE_NORMAL, VLC_MSG_DBG, \ __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_DBG, \
MODULE_STRING, __VA_ARGS__ ) MODULE_STRING, __VA_ARGS__ )
#define msg_Subscribe(a,b) __msg_Subscribe(VLC_OBJECT(a),b) #define msg_Subscribe(a) __msg_Subscribe(VLC_OBJECT(a))
#define msg_Unsubscribe(a,b) __msg_Unsubscribe(VLC_OBJECT(a),b) #define msg_Unsubscribe(a,b) __msg_Unsubscribe(VLC_OBJECT(a),b)
VLC_EXPORT( msg_subscription_t*, __msg_Subscribe, ( vlc_object_t *, int ) ); VLC_EXPORT( msg_subscription_t*, __msg_Subscribe, ( vlc_object_t * ) );
VLC_EXPORT( void, __msg_Unsubscribe, ( vlc_object_t *, msg_subscription_t * ) ); VLC_EXPORT( void, __msg_Unsubscribe, ( vlc_object_t *, msg_subscription_t * ) );
/** /**
......
...@@ -447,7 +447,7 @@ void LibavcodecCallback( void *p_opaque, int i_level, ...@@ -447,7 +447,7 @@ void LibavcodecCallback( void *p_opaque, int i_level,
+ 18 + 5 ); + 18 + 5 );
snprintf( psz_new_format, strlen(psz_format) + strlen(psz_item_name) snprintf( psz_new_format, strlen(psz_format) + strlen(psz_item_name)
+ 18 + 5, "%s (%s@%p)", psz_format, p_avc->item_name(p_opaque), p_opaque ); + 18 + 5, "%s (%s@%p)", psz_format, p_avc->item_name(p_opaque), p_opaque );
msg_GenericVa( p_this, MSG_QUEUE_NORMAL, i_vlc_level, msg_GenericVa( p_this, i_vlc_level,
MODULE_STRING, psz_new_format, va ); MODULE_STRING, psz_new_format, va );
free( psz_new_format ); free( psz_new_format );
} }
......
...@@ -503,7 +503,7 @@ static void MkvTree( demux_t & demuxer, int i_level, const char *psz_format, ... ...@@ -503,7 +503,7 @@ static void MkvTree( demux_t & demuxer, int i_level, const char *psz_format, ...
psz_foo2[ 4 * i_level ] = '+'; psz_foo2[ 4 * i_level ] = '+';
psz_foo2[ 4 * i_level + 1 ] = ' '; psz_foo2[ 4 * i_level + 1 ] = ' ';
strcpy( &psz_foo2[ 4 * i_level + 2 ], psz_format ); strcpy( &psz_foo2[ 4 * i_level + 2 ], psz_format );
__msg_GenericVa( VLC_OBJECT(&demuxer), MSG_QUEUE_NORMAL, VLC_MSG_DBG, "mkv", psz_foo2, args ); __msg_GenericVa( VLC_OBJECT(&demuxer),VLC_MSG_DBG, "mkv", psz_foo2, args );
free( psz_foo2 ); free( psz_foo2 );
va_end( args ); va_end( args );
} }
......
...@@ -126,7 +126,7 @@ MessagesWindow::MessagesWindow( intf_thread_t * _p_intf, ...@@ -126,7 +126,7 @@ MessagesWindow::MessagesWindow( intf_thread_t * _p_intf,
{ {
SetSizeLimits( 400, 2000, 200, 2000 ); SetSizeLimits( 400, 2000, 200, 2000 );
p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL ); p_sub = msg_Subscribe( p_intf );
BRect rect, textRect; BRect rect, textRect;
......
...@@ -107,7 +107,7 @@ int OpenIntf ( vlc_object_t *p_this ) ...@@ -107,7 +107,7 @@ int OpenIntf ( vlc_object_t *p_this )
p_intf->p_sys->o_pool = [[NSAutoreleasePool alloc] init]; p_intf->p_sys->o_pool = [[NSAutoreleasePool alloc] init];
p_intf->p_sys->o_sendport = [[NSPort port] retain]; p_intf->p_sys->o_sendport = [[NSPort port] retain];
p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL ); p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
p_intf->b_play = true; p_intf->b_play = true;
p_intf->pf_run = Run; p_intf->pf_run = Run;
p_intf->b_should_run_on_first_thread = true; p_intf->b_should_run_on_first_thread = true;
......
...@@ -256,7 +256,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -256,7 +256,7 @@ static int Open( vlc_object_t *p_this )
p_sys->b_box_cleared = false; p_sys->b_box_cleared = false;
p_sys->i_box_plidx = 0; p_sys->i_box_plidx = 0;
p_sys->i_box_bidx = 0; p_sys->i_box_bidx = 0;
p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL ); p_sys->p_sub = msg_Subscribe( p_intf );
p_sys->b_color = var_CreateGetBool( p_intf, "color" ); p_sys->b_color = var_CreateGetBool( p_intf, "color" );
p_sys->b_color_started = false; p_sys->b_color_started = false;
......
...@@ -233,7 +233,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -233,7 +233,7 @@ static int Open( vlc_object_t *p_this )
p_intf->pf_run = Run; p_intf->pf_run = Run;
p_intf->p_sys->p_playlist = pl_Yield( p_intf ); p_intf->p_sys->p_playlist = pl_Yield( p_intf );
p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL ); p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
/* We support play on start */ /* We support play on start */
p_intf->b_play = true; p_intf->b_play = true;
......
...@@ -95,7 +95,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -95,7 +95,7 @@ static int Open( vlc_object_t *p_this )
p_intf->pf_run = Run; p_intf->pf_run = Run;
// Suscribe to messages bank // Suscribe to messages bank
p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL ); p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
p_intf->p_sys->p_input = NULL; p_intf->p_sys->p_input = NULL;
p_intf->p_sys->p_playlist = (playlist_t *)vlc_object_find( p_intf, p_intf->p_sys->p_playlist = (playlist_t *)vlc_object_find( p_intf,
......
...@@ -116,7 +116,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -116,7 +116,7 @@ static int Open( vlc_object_t *p_this )
} }
// Suscribe to messages bank // Suscribe to messages bank
p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL ); p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
// Misc init // Misc init
p_intf->p_sys->p_audio_menu = NULL; p_intf->p_sys->p_audio_menu = NULL;
......
...@@ -199,7 +199,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -199,7 +199,7 @@ static int Open( vlc_object_t *p_this )
p_intf->pf_run = Run; p_intf->pf_run = Run;
p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL ); p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
/* Initialize wxWidgets thread */ /* Initialize wxWidgets thread */
p_intf->p_sys->b_playing = 0; p_intf->p_sys->b_playing = 0;
......
...@@ -291,7 +291,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -291,7 +291,7 @@ static int Open( vlc_object_t *p_this )
p_intf->p_sys->p_rrd = utf8_fopen( psz_rrd_file, "w" ); p_intf->p_sys->p_rrd = utf8_fopen( psz_rrd_file, "w" );
} }
p_intf->p_sys->p_sub = msg_Subscribe( p_intf , MSG_QUEUE_NORMAL ); p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
p_intf->pf_run = Run; p_intf->pf_run = Run;
return 0; return 0;
......
...@@ -64,8 +64,7 @@ static inline void lua_Dbg( vlc_object_t * p_this, const char * ppz_fmt, ... ) ...@@ -64,8 +64,7 @@ static inline void lua_Dbg( vlc_object_t * p_this, const char * ppz_fmt, ... )
{ {
va_list ap; va_list ap;
va_start( ap, ppz_fmt ); va_start( ap, ppz_fmt );
__msg_GenericVa( ( vlc_object_t *)p_this, MSG_QUEUE_NORMAL, __msg_GenericVa( ( vlc_object_t *)p_this, VLC_MSG_DBG, MODULE_STRING,
VLC_MSG_DBG, MODULE_STRING,
ppz_fmt, ap ); ppz_fmt, ap );
va_end( ap ); va_end( ap );
} }
......
...@@ -69,7 +69,7 @@ libvlc_log_t *libvlc_log_open( libvlc_instance_t *p_instance, libvlc_exception_t ...@@ -69,7 +69,7 @@ libvlc_log_t *libvlc_log_open( libvlc_instance_t *p_instance, libvlc_exception_t
if( !p_log ) RAISENULL( "Out of memory" ); if( !p_log ) RAISENULL( "Out of memory" );
p_log->p_instance = p_instance; p_log->p_instance = p_instance;
p_log->p_messages = msg_Subscribe(p_instance->p_libvlc_int, MSG_QUEUE_NORMAL); p_log->p_messages = msg_Subscribe(p_instance->p_libvlc_int);
if( !p_log->p_messages ) if( !p_log->p_messages )
{ {
......
...@@ -63,12 +63,8 @@ uint32_t CPUCapabilities( void ); ...@@ -63,12 +63,8 @@ uint32_t CPUCapabilities( void );
* Message/logging stuff * Message/logging stuff
*/ */
#define NB_QUEUES 2
typedef struct msg_queue_t typedef struct msg_queue_t
{ {
int i_id;
/** Message queue lock */ /** Message queue lock */
vlc_mutex_t lock; vlc_mutex_t lock;
bool b_overflow; bool b_overflow;
...@@ -94,7 +90,7 @@ typedef struct msg_queue_t ...@@ -94,7 +90,7 @@ typedef struct msg_queue_t
typedef struct msg_bank_t typedef struct msg_bank_t
{ {
vlc_mutex_t lock; vlc_mutex_t lock;
msg_queue_t queues[NB_QUEUES]; msg_queue_t queue;
} msg_bank_t; } msg_bank_t;
void msg_Create (libvlc_int_t *); void msg_Create (libvlc_int_t *);
......
...@@ -66,14 +66,14 @@ ...@@ -66,14 +66,14 @@
# define vlc_va_copy(dest,src) (dest)=(src) # define vlc_va_copy(dest,src) (dest)=(src)
#endif #endif
#define QUEUE(i) priv->msg_bank.queues[i] #define QUEUE priv->msg_bank.queue
#define LOCK_BANK vlc_mutex_lock( &priv->msg_bank.lock ); #define LOCK_BANK vlc_mutex_lock( &priv->msg_bank.lock );
#define UNLOCK_BANK vlc_mutex_unlock( &priv->msg_bank.lock ); #define UNLOCK_BANK vlc_mutex_unlock( &priv->msg_bank.lock );
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static void QueueMsg ( vlc_object_t *, int, int , const char *, static void QueueMsg ( vlc_object_t *, int, const char *,
const char *, va_list ); const char *, va_list );
static void FlushMsg ( msg_queue_t * ); static void FlushMsg ( msg_queue_t * );
static void PrintMsg ( vlc_object_t *, msg_item_t * ); static void PrintMsg ( vlc_object_t *, msg_item_t * );
...@@ -86,24 +86,19 @@ void msg_Create (libvlc_int_t *p_libvlc) ...@@ -86,24 +86,19 @@ void msg_Create (libvlc_int_t *p_libvlc)
{ {
libvlc_priv_t *priv = libvlc_priv (p_libvlc); libvlc_priv_t *priv = libvlc_priv (p_libvlc);
vlc_mutex_init( &priv->msg_bank.lock ); vlc_mutex_init( &priv->msg_bank.lock );
vlc_mutex_init( &QUEUE.lock );
for( int i = 0; i < 2; i++ ) QUEUE.b_overflow = false;
{ QUEUE.i_start = 0;
vlc_mutex_init( &QUEUE(i).lock ); QUEUE.i_stop = 0;
QUEUE(i).b_overflow = false; QUEUE.i_sub = 0;
QUEUE(i).i_id = i; QUEUE.pp_sub = 0;
QUEUE(i).i_start = 0;
QUEUE(i).i_stop = 0;
QUEUE(i).i_sub = 0;
QUEUE(i).pp_sub = 0;
}
#ifdef UNDER_CE #ifdef UNDER_CE
QUEUE(MSG_QUEUE_NORMAL).logfile = QUEUE.logfile =
CreateFile( L"vlc-log.txt", GENERIC_WRITE, CreateFile( L"vlc-log.txt", GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
CREATE_ALWAYS, 0, NULL ); CREATE_ALWAYS, 0, NULL );
SetFilePointer( QUEUE(MSG_QUEUE_NORMAL).logfile, 0, NULL, FILE_END ); SetFilePointer( QUEUE.logfile, 0, NULL, FILE_END );
#endif #endif
} }
...@@ -113,13 +108,9 @@ void msg_Create (libvlc_int_t *p_libvlc) ...@@ -113,13 +108,9 @@ void msg_Create (libvlc_int_t *p_libvlc)
void msg_Flush (libvlc_int_t *p_libvlc) void msg_Flush (libvlc_int_t *p_libvlc)
{ {
libvlc_priv_t *priv = libvlc_priv (p_libvlc); libvlc_priv_t *priv = libvlc_priv (p_libvlc);
vlc_mutex_lock( &QUEUE.lock );
for( int i = 0 ; i < NB_QUEUES ; i++ ) FlushMsg( &QUEUE );
{ vlc_mutex_unlock( &QUEUE.lock );
vlc_mutex_lock( &QUEUE(i).lock );
FlushMsg( &QUEUE(i) );
vlc_mutex_unlock( &QUEUE(i).lock );
}
} }
/** /**
...@@ -133,27 +124,23 @@ void msg_Destroy (libvlc_int_t *p_libvlc) ...@@ -133,27 +124,23 @@ void msg_Destroy (libvlc_int_t *p_libvlc)
{ {
libvlc_priv_t *priv = libvlc_priv (p_libvlc); libvlc_priv_t *priv = libvlc_priv (p_libvlc);
for( int i = NB_QUEUES -1 ; i >= 0; i-- ) if( QUEUE.i_sub )
{ msg_Err( p_libvlc, "stale interface subscribers" );
if( QUEUE(i).i_sub )
msg_Err( p_libvlc, "stale interface subscribers" );
FlushMsg( &QUEUE(i) ); FlushMsg( &QUEUE );
#ifdef UNDER_CE #ifdef UNDER_CE
if( i == MSG_QUEUE_NORMAL ) CloseHandle( QUEUE.logfile );
CloseHandle( QUEUE(MSG_QUEUE_NORMAL).logfile );
#endif #endif
/* Destroy lock */ /* Destroy lock */
vlc_mutex_destroy( &QUEUE(i).lock ); vlc_mutex_destroy( &QUEUE.lock );
}
vlc_mutex_destroy( &priv->msg_bank.lock); vlc_mutex_destroy( &priv->msg_bank.lock);
} }
/** /**
* Subscribe to a message queue. * Subscribe to a message queue.
*/ */
msg_subscription_t *__msg_Subscribe( vlc_object_t *p_this, int i ) msg_subscription_t *__msg_Subscribe( vlc_object_t *p_this )
{ {
libvlc_priv_t *priv = libvlc_priv (p_this->p_libvlc); libvlc_priv_t *priv = libvlc_priv (p_this->p_libvlc);
msg_subscription_t *p_sub = malloc( sizeof( msg_subscription_t ) ); msg_subscription_t *p_sub = malloc( sizeof( msg_subscription_t ) );
...@@ -161,19 +148,17 @@ msg_subscription_t *__msg_Subscribe( vlc_object_t *p_this, int i ) ...@@ -161,19 +148,17 @@ msg_subscription_t *__msg_Subscribe( vlc_object_t *p_this, int i )
if (p_sub == NULL) if (p_sub == NULL)
return NULL; return NULL;
assert( i < NB_QUEUES );
LOCK_BANK; LOCK_BANK;
vlc_mutex_lock( &QUEUE(i).lock ); vlc_mutex_lock( &QUEUE.lock );
TAB_APPEND( QUEUE(i).i_sub, QUEUE(i).pp_sub, p_sub ); TAB_APPEND( QUEUE.i_sub, QUEUE.pp_sub, p_sub );
p_sub->i_start = QUEUE(i).i_start; p_sub->i_start = QUEUE.i_start;
p_sub->pi_stop = &QUEUE(i).i_stop; p_sub->pi_stop = &QUEUE.i_stop;
p_sub->p_msg = QUEUE(i).msg; p_sub->p_msg = QUEUE.msg;
p_sub->p_lock = &QUEUE(i).lock; p_sub->p_lock = &QUEUE.lock;
vlc_mutex_unlock( &QUEUE(i).lock ); vlc_mutex_unlock( &QUEUE.lock );
UNLOCK_BANK; UNLOCK_BANK;
return p_sub; return p_sub;
...@@ -187,19 +172,16 @@ void __msg_Unsubscribe( vlc_object_t *p_this, msg_subscription_t *p_sub ) ...@@ -187,19 +172,16 @@ void __msg_Unsubscribe( vlc_object_t *p_this, msg_subscription_t *p_sub )
libvlc_priv_t *priv = libvlc_priv (p_this->p_libvlc); libvlc_priv_t *priv = libvlc_priv (p_this->p_libvlc);
LOCK_BANK; LOCK_BANK;
for( int i = 0 ; i< NB_QUEUES ; i++ ) vlc_mutex_lock( &QUEUE.lock );
for( int j = 0 ; j< QUEUE.i_sub ; j++ )
{ {
vlc_mutex_lock( &QUEUE(i).lock ); if( QUEUE.pp_sub[j] == p_sub )
for( int j = 0 ; j< QUEUE(i).i_sub ; j++ )
{ {
if( QUEUE(i).pp_sub[j] == p_sub ) REMOVE_ELEM( QUEUE.pp_sub, QUEUE.i_sub, j );
{ free( p_sub );
REMOVE_ELEM( QUEUE(i).pp_sub, QUEUE(i).i_sub, j );
free( p_sub );
}
} }
vlc_mutex_unlock( & QUEUE(i).lock );
} }
vlc_mutex_unlock( &QUEUE.lock );
UNLOCK_BANK; UNLOCK_BANK;
} }
...@@ -208,22 +190,20 @@ void __msg_Unsubscribe( vlc_object_t *p_this, msg_subscription_t *p_sub ) ...@@ -208,22 +190,20 @@ void __msg_Unsubscribe( vlc_object_t *p_this, msg_subscription_t *p_sub )
***************************************************************************** *****************************************************************************
* These functions queue a message for later printing. * These functions queue a message for later printing.
*****************************************************************************/ *****************************************************************************/
void __msg_Generic( vlc_object_t *p_this, int i_queue, int i_type, void __msg_Generic( vlc_object_t *p_this, int i_type, const char *psz_module,
const char *psz_module,
const char *psz_format, ... ) const char *psz_format, ... )
{ {
va_list args; va_list args;
va_start( args, psz_format ); va_start( args, psz_format );
QueueMsg( p_this, i_queue, i_type, psz_module, psz_format, args ); QueueMsg( p_this, i_type, psz_module, psz_format, args );
va_end( args ); va_end( args );
} }
void __msg_GenericVa( vlc_object_t *p_this, int i_queue, void __msg_GenericVa( vlc_object_t *p_this, int i_type, const char *psz_module,
int i_type, const char *psz_module,
const char *psz_format, va_list args ) const char *psz_format, va_list args )
{ {
QueueMsg( p_this, i_queue, i_type, psz_module, psz_format, args ); QueueMsg( p_this, i_type, psz_module, psz_format, args );
} }
/* Generic functions used when variadic macros are not available. */ /* Generic functions used when variadic macros are not available. */
...@@ -232,8 +212,7 @@ void __msg_GenericVa( vlc_object_t *p_this, int i_queue, ...@@ -232,8 +212,7 @@ void __msg_GenericVa( vlc_object_t *p_this, int i_queue,
{ \ { \
va_list args; \ va_list args; \
va_start( args, psz_format ); \ va_start( args, psz_format ); \
QueueMsg( p_this,MSG_QUEUE_NORMAL, FN_TYPE, "unknown", \ QueueMsg( p_this, FN_TYPE, "unknown", psz_format, args ); \
psz_format, args ); \
va_end( args ); \ va_end( args ); \
} \ } \
struct _ struct _
...@@ -264,8 +243,7 @@ DECLARE_MSG_FN( __msg_Dbg, VLC_MSG_DBG ); ...@@ -264,8 +243,7 @@ DECLARE_MSG_FN( __msg_Dbg, VLC_MSG_DBG );
* is full). If the message can't be converted to string in memory, it issues * is full). If the message can't be converted to string in memory, it issues
* a warning. * a warning.
*/ */
static void QueueMsg( vlc_object_t *p_this, int i_queue, int i_type, static void QueueMsg( vlc_object_t *p_this, int i_type, const char *psz_module,
const char *psz_module,
const char *psz_format, va_list _args ) const char *psz_format, va_list _args )
{ {
assert (p_this); assert (p_this);
...@@ -410,9 +388,8 @@ static void QueueMsg( vlc_object_t *p_this, int i_queue, int i_type, ...@@ -410,9 +388,8 @@ static void QueueMsg( vlc_object_t *p_this, int i_queue, int i_type,
psz_str[ i_size - 1 ] = 0; /* Just in case */ psz_str[ i_size - 1 ] = 0; /* Just in case */
#endif #endif
assert( i_queue < NB_QUEUES );
LOCK_BANK; LOCK_BANK;
p_queue = &QUEUE(i_queue) ; p_queue = &QUEUE;
vlc_mutex_lock( &p_queue->lock ); vlc_mutex_lock( &p_queue->lock );
/* Check there is room in the queue for our message */ /* Check there is room in the queue for our message */
...@@ -439,23 +416,20 @@ static void QueueMsg( vlc_object_t *p_this, int i_queue, int i_type, ...@@ -439,23 +416,20 @@ static void QueueMsg( vlc_object_t *p_this, int i_queue, int i_type,
{ {
p_queue->b_overflow = true; p_queue->b_overflow = true;
if( p_queue->i_id == MSG_QUEUE_NORMAL ) /* Put the overflow message in the queue */
{ p_item = p_queue->msg + p_queue->i_stop;
/* Put the overflow message in the queue */ p_queue->i_stop = (p_queue->i_stop + 1) % VLC_MSG_QSIZE;
p_item = p_queue->msg + p_queue->i_stop;
p_queue->i_stop = (p_queue->i_stop + 1) % VLC_MSG_QSIZE; p_item->i_type = VLC_MSG_WARN;
p_item->i_object_id = p_this->i_object_id;
p_item->i_type = VLC_MSG_WARN; p_item->psz_object_type = p_this->psz_object_type;
p_item->i_object_id = p_this->i_object_id; p_item->psz_module = strdup( "message" );
p_item->psz_object_type = p_this->psz_object_type; p_item->psz_msg = strdup( "message queue overflowed" );
p_item->psz_module = strdup( "message" ); p_item->psz_header = NULL;
p_item->psz_msg = strdup( "message queue overflowed" );
p_item->psz_header = NULL; PrintMsg( p_this, p_item );
/* We print from a dummy item */
PrintMsg( p_this, p_item ); p_item = &item;
/* We print from a dummy item */
p_item = &item;
}
} }
} }
...@@ -474,8 +448,7 @@ static void QueueMsg( vlc_object_t *p_this, int i_queue, int i_type, ...@@ -474,8 +448,7 @@ static void QueueMsg( vlc_object_t *p_this, int i_queue, int i_type,
p_item->psz_msg = psz_str; p_item->psz_msg = psz_str;
p_item->psz_header = psz_header; p_item->psz_header = psz_header;
if( p_queue->i_id == MSG_QUEUE_NORMAL ) PrintMsg( p_this, p_item );
PrintMsg( p_this, p_item );
if( p_queue->b_overflow ) if( p_queue->b_overflow )
{ {
...@@ -575,7 +548,7 @@ static void PrintMsg ( vlc_object_t * p_this, msg_item_t * p_item ) ...@@ -575,7 +548,7 @@ static void PrintMsg ( vlc_object_t * p_this, msg_item_t * p_item )
psz_object = p_item->psz_object_type; psz_object = p_item->psz_object_type;
#ifdef UNDER_CE #ifdef UNDER_CE
# define CE_WRITE(str) WriteFile( QUEUE(MSG_QUEUE_NORMAL).logfile, \ # define CE_WRITE(str) WriteFile( QUEUE.logfile, \
str, strlen(str), &i_dummy, NULL ); str, strlen(str), &i_dummy, NULL );
CE_WRITE( p_item->psz_module ); CE_WRITE( p_item->psz_module );
CE_WRITE( " " ); CE_WRITE( " " );
...@@ -584,7 +557,7 @@ static void PrintMsg ( vlc_object_t * p_this, msg_item_t * p_item ) ...@@ -584,7 +557,7 @@ static void PrintMsg ( vlc_object_t * p_this, msg_item_t * p_item )
CE_WRITE( ": " ); CE_WRITE( ": " );
CE_WRITE( p_item->psz_msg ); CE_WRITE( p_item->psz_msg );
CE_WRITE( "\r\n" ); CE_WRITE( "\r\n" );
FlushFileBuffers( QUEUE(MSG_QUEUE_NORMAL).logfile ); FlushFileBuffers( QUEUE.logfile );
#else #else
/* Send the message to stderr */ /* Send the message to stderr */
......
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