all:

 * doxygenated parts of the messages system
parent 8cedcb3c
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* interface, such as message output. * interface, such as message output.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: vlc_messages.h,v 1.8 2002/12/18 11:47:35 sam Exp $ * $Id: vlc_messages.h,v 1.9 2003/12/03 23:01:48 sigmunau Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -25,19 +25,25 @@ ...@@ -25,19 +25,25 @@
*****************************************************************************/ *****************************************************************************/
#include <stdarg.h> #include <stdarg.h>
/**
* \defgroup messages Messages
* This library provides basic functions for threads to interact with user
* interface, such as message output.
*
* @{
*/
/*****************************************************************************
* msg_item_t /**
*****************************************************************************
* Store a single message. * Store a single message.
*****************************************************************************/ */
typedef struct typedef struct
{ {
int i_type; /* message type, see below */ int i_type; /**< message type, see below */
int i_object_id; int i_object_id;
int i_object_type; int i_object_type;
char * psz_module; char * psz_module;
char * psz_msg; /* the message itself */ char * psz_msg; /**< the message itself */
#if 0 #if 0
mtime_t date; /* date of the message */ mtime_t date; /* date of the message */
...@@ -48,25 +54,27 @@ typedef struct ...@@ -48,25 +54,27 @@ typedef struct
} msg_item_t; } msg_item_t;
/* Message types */ /* Message types */
#define VLC_MSG_INFO 0 /* standard messages */ /** standard messages */
#define VLC_MSG_ERR 1 /* error messages */ #define VLC_MSG_INFO 0
#define VLC_MSG_WARN 2 /* warning messages */ /** error messages */
#define VLC_MSG_DBG 3 /* debug messages */ #define VLC_MSG_ERR 1
/** warning messages */
/***************************************************************************** #define VLC_MSG_WARN 2
* msg_bank_t /** debug messages */
***************************************************************************** #define VLC_MSG_DBG 3
/**
* Store all data requiered by messages interfaces. * Store all data requiered by messages interfaces.
*****************************************************************************/ */
struct msg_bank_t struct msg_bank_t
{ {
/* Message queue lock */ /** Message queue lock */
vlc_mutex_t lock; vlc_mutex_t lock;
vlc_bool_t b_configured; vlc_bool_t b_configured;
vlc_bool_t b_overflow; vlc_bool_t b_overflow;
/* Message queue */ /* Message queue */
msg_item_t msg[VLC_MSG_QSIZE]; /* message queue */ msg_item_t msg[VLC_MSG_QSIZE]; /**< message queue */
int i_start; int i_start;
int i_stop; int i_stop;
...@@ -80,11 +88,9 @@ struct msg_bank_t ...@@ -80,11 +88,9 @@ struct msg_bank_t
#endif #endif
}; };
/***************************************************************************** /**
* msg_subscription_t
*****************************************************************************
* Used by interface plugins which subscribe to the message bank. * Used by interface plugins which subscribe to the message bank.
*****************************************************************************/ */
struct msg_subscription_t struct msg_subscription_t
{ {
int i_start; int i_start;
...@@ -98,10 +104,10 @@ struct msg_subscription_t ...@@ -98,10 +104,10 @@ struct msg_subscription_t
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
VLC_EXPORT( void, __msg_Generic, ( vlc_object_t *, int, const char *, const char *, ... ) ATTRIBUTE_FORMAT( 4, 5 ) ); VLC_EXPORT( void, __msg_Generic, ( vlc_object_t *, int, const char *, const char *, ... ) ATTRIBUTE_FORMAT( 4, 5 ) );
VLC_EXPORT( void, __msg_Info, ( void *, 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, ( void *, 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, ( void *, 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, ( void *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) ); VLC_EXPORT( void, __msg_Dbg, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) );
#ifdef HAVE_VARIADIC_MACROS #ifdef HAVE_VARIADIC_MACROS
...@@ -142,3 +148,7 @@ void __msg_Destroy ( vlc_object_t * ); ...@@ -142,3 +148,7 @@ void __msg_Destroy ( vlc_object_t * );
VLC_EXPORT( msg_subscription_t*, __msg_Subscribe, ( vlc_object_t * ) ); 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 * ) );
/**
* @}
*/
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* modules, especially intf modules. See config.h for output configuration. * modules, especially intf modules. See config.h for output configuration.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: messages.c,v 1.35 2003/10/08 21:01:07 gbazin Exp $ * $Id: messages.c,v 1.36 2003/12/03 23:01:48 sigmunau Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -67,12 +67,12 @@ static void QueueMsg ( vlc_object_t *, int , const char *, ...@@ -67,12 +67,12 @@ static void QueueMsg ( vlc_object_t *, int , const char *,
static void FlushMsg ( msg_bank_t * ); static void FlushMsg ( msg_bank_t * );
static void PrintMsg ( vlc_object_t *, msg_item_t * ); static void PrintMsg ( vlc_object_t *, msg_item_t * );
/***************************************************************************** /**
* msg_Create: initialize messages interface * Initialize messages interface
***************************************************************************** *
* This functions has to be called before any call to other msg_* functions. * This functions has to be called before any call to other msg_* functions.
* It set up the locks and the message queue if it is used. * It set up the locks and the message queue if it is used.
*****************************************************************************/ */
void __msg_Create( vlc_object_t *p_this ) void __msg_Create( vlc_object_t *p_this )
{ {
/* Message queue initialization */ /* Message queue initialization */
...@@ -96,9 +96,9 @@ void __msg_Create( vlc_object_t *p_this ) ...@@ -96,9 +96,9 @@ void __msg_Create( vlc_object_t *p_this )
#endif #endif
} }
/***************************************************************************** /**
* msg_Flush: flush the message queue * Flush the message queue
*****************************************************************************/ */
void __msg_Flush( vlc_object_t *p_this ) void __msg_Flush( vlc_object_t *p_this )
{ {
int i_index; int i_index;
...@@ -119,13 +119,13 @@ void __msg_Flush( vlc_object_t *p_this ) ...@@ -119,13 +119,13 @@ void __msg_Flush( vlc_object_t *p_this )
vlc_mutex_unlock( &p_this->p_libvlc->msg_bank.lock ); vlc_mutex_unlock( &p_this->p_libvlc->msg_bank.lock );
} }
/***************************************************************************** /**
* msg_Destroy: free resources allocated by msg_Create * Free resources allocated by msg_Create
***************************************************************************** *
* This functions prints all messages remaining in queue, then free all the * This functions prints all messages remaining in queue, then free all the
* resources allocated by msg_Create. * resources allocated by msg_Create.
* No other messages interface functions should be called after this one. * No other messages interface functions should be called after this one.
*****************************************************************************/ */
void __msg_Destroy( vlc_object_t *p_this ) void __msg_Destroy( vlc_object_t *p_this )
{ {
if( p_this->p_libvlc->msg_bank.i_sub ) if( p_this->p_libvlc->msg_bank.i_sub )
...@@ -151,9 +151,9 @@ void __msg_Destroy( vlc_object_t *p_this ) ...@@ -151,9 +151,9 @@ void __msg_Destroy( vlc_object_t *p_this )
vlc_mutex_destroy( &p_this->p_libvlc->msg_bank.lock ); vlc_mutex_destroy( &p_this->p_libvlc->msg_bank.lock );
} }
/***************************************************************************** /**
* msg_Subscribe: subscribe to the message queue. * Subscribe to the message queue.
*****************************************************************************/ */
msg_subscription_t *__msg_Subscribe( vlc_object_t *p_this ) msg_subscription_t *__msg_Subscribe( vlc_object_t *p_this )
{ {
msg_bank_t *p_bank = &p_this->p_libvlc->msg_bank; msg_bank_t *p_bank = &p_this->p_libvlc->msg_bank;
...@@ -175,9 +175,9 @@ msg_subscription_t *__msg_Subscribe( vlc_object_t *p_this ) ...@@ -175,9 +175,9 @@ msg_subscription_t *__msg_Subscribe( vlc_object_t *p_this )
return p_sub; return p_sub;
} }
/***************************************************************************** /**
* msg_Unsubscribe: unsubscribe from the message queue. * Unsubscribe from the message queue.
*****************************************************************************/ */
void __msg_Unsubscribe( vlc_object_t *p_this, msg_subscription_t *p_sub ) void __msg_Unsubscribe( vlc_object_t *p_this, msg_subscription_t *p_sub )
{ {
msg_bank_t *p_bank = &p_this->p_libvlc->msg_bank; msg_bank_t *p_bank = &p_this->p_libvlc->msg_bank;
...@@ -231,7 +231,7 @@ void __msg_Generic( vlc_object_t *p_this, int i_type, const char *psz_module, ...@@ -231,7 +231,7 @@ void __msg_Generic( vlc_object_t *p_this, int i_type, const char *psz_module,
/* Generic functions used when variadic macros are not available. */ /* Generic functions used when variadic macros are not available. */
#define DECLARE_MSG_FN( FN_NAME, FN_TYPE ) \ #define DECLARE_MSG_FN( FN_NAME, FN_TYPE ) \
void FN_NAME( void *p_this, const char *psz_format, ... ) \ void FN_NAME( vlc_object_t *p_this, const char *psz_format, ... ) \
{ \ { \
va_list args; \ va_list args; \
va_start( args, psz_format ); \ va_start( args, psz_format ); \
...@@ -240,20 +240,33 @@ void __msg_Generic( vlc_object_t *p_this, int i_type, const char *psz_module, ...@@ -240,20 +240,33 @@ void __msg_Generic( vlc_object_t *p_this, int i_type, const char *psz_module,
va_end( args ); \ va_end( args ); \
} \ } \
struct _ struct _
/**
* Output an informational message.
* \note Do not use this for debug messages
* \see input_AddInfo
*/
DECLARE_MSG_FN( __msg_Info, VLC_MSG_INFO ); DECLARE_MSG_FN( __msg_Info, VLC_MSG_INFO );
/**
* Output an error message.
*/
DECLARE_MSG_FN( __msg_Err, VLC_MSG_ERR ); DECLARE_MSG_FN( __msg_Err, VLC_MSG_ERR );
/**
* Output a waring message
*/
DECLARE_MSG_FN( __msg_Warn, VLC_MSG_WARN ); DECLARE_MSG_FN( __msg_Warn, VLC_MSG_WARN );
/**
* Output a debug message
*/
DECLARE_MSG_FN( __msg_Dbg, VLC_MSG_DBG ); DECLARE_MSG_FN( __msg_Dbg, VLC_MSG_DBG );
/***************************************************************************** /**
* QueueMsg: add a message to a queue * Add a message to a queue
***************************************************************************** *
* This function provides basic functionnalities to other msg_* functions. * This function provides basic functionnalities to other msg_* functions.
* It adds a message to a queue (after having printed all stored messages if it * It adds a message to a queue (after having printed all stored messages if it
* 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_type, const char *psz_module, static void QueueMsg( vlc_object_t *p_this, int i_type, const char *psz_module,
const char *psz_format, va_list _args ) const char *psz_format, va_list _args )
{ {
......
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