00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <stdarg.h>
00040 typedef struct
00041 {
00042 int i_type;
00043 int i_object_id;
00044 int i_object_type;
00045 char * psz_module;
00046 char * psz_msg;
00048 #if 0
00049 mtime_t date;
00050 char * psz_file;
00051 char * psz_function;
00052 int i_line;
00053 #endif
00054 } msg_item_t;
00055
00056
00058 #define VLC_MSG_INFO 0
00059
00060 #define VLC_MSG_ERR 1
00061
00062 #define VLC_MSG_WARN 2
00063
00064 #define VLC_MSG_DBG 3
00065
00069 struct msg_bank_t
00070 {
00072 vlc_mutex_t lock;
00073 vlc_bool_t b_configured;
00074 vlc_bool_t b_overflow;
00075
00076
00077 msg_item_t msg[VLC_MSG_QSIZE];
00078 int i_start;
00079 int i_stop;
00080
00081
00082 int i_sub;
00083 msg_subscription_t **pp_sub;
00084
00085
00086 #ifdef UNDER_CE
00087 FILE *logfile;
00088 #endif
00089 };
00090
00094 struct msg_subscription_t
00095 {
00096 int i_start;
00097 int* pi_stop;
00098
00099 msg_item_t* p_msg;
00100 vlc_mutex_t* p_lock;
00101 };
00102
00103
00104
00105
00106 VLC_EXPORT( void, __msg_Generic, ( vlc_object_t *, int, const char *, const char *, ... ) ATTRIBUTE_FORMAT( 4, 5 ) );
00107 VLC_EXPORT( void, __msg_GenericVa, ( vlc_object_t *, int, const char *, const char *, va_list args ) );
00108 #define msg_GenericVa(a, b, c, d, e) __msg_GenericVa(VLC_OBJECT(a), b, c, d, e)
00109 VLC_EXPORT( void, __msg_Info, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) );
00110 VLC_EXPORT( void, __msg_Err, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) );
00111 VLC_EXPORT( void, __msg_Warn, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) );
00112 VLC_EXPORT( void, __msg_Dbg, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) );
00113
00114 #ifdef HAVE_VARIADIC_MACROS
00115
00116 # define msg_Info( p_this, psz_format, args... ) \
00117 __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_INFO, MODULE_STRING, \
00118 psz_format, ## args )
00119
00120 # define msg_Err( p_this, psz_format, args... ) \
00121 __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_ERR, MODULE_STRING, \
00122 psz_format, ## args )
00123
00124 # define msg_Warn( p_this, psz_format, args... ) \
00125 __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_WARN, MODULE_STRING, \
00126 psz_format, ## args )
00127
00128 # define msg_Dbg( p_this, psz_format, args... ) \
00129 __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_DBG, MODULE_STRING, \
00130 psz_format, ## args )
00131
00132 #elif defined(_MSC_VER)
00133
00134 inline void msg_Info( void *p_this, const char *psz_format, ... )
00135 {
00136 va_list ap;
00137 va_start( ap, psz_format );
00138 __msg_GenericVa( ( vlc_object_t *)p_this, VLC_MSG_INFO, MODULE_STRING,
00139 psz_format, ap );
00140 va_end(ap);
00141 }
00142 inline void msg_Err( void *p_this, const char *psz_format, ... )
00143 {
00144 va_list ap;
00145 va_start( ap, psz_format );
00146 __msg_GenericVa( ( vlc_object_t *)p_this, VLC_MSG_ERR, MODULE_STRING,
00147 psz_format, ap );
00148 va_end(ap);
00149 }
00150 inline void msg_Warn( void *p_this, const char *psz_format, ... )
00151 {
00152 va_list ap;
00153 va_start( ap, psz_format );
00154 __msg_GenericVa( ( vlc_object_t *)p_this, VLC_MSG_WARN, MODULE_STRING,
00155 psz_format, ap );
00156 va_end(ap);
00157 }
00158 inline void msg_Dbg( void *p_this, const char *psz_format, ... )
00159 {
00160 va_list ap;
00161 va_start( ap, psz_format );
00162 __msg_GenericVa( ( vlc_object_t *)p_this, VLC_MSG_DBG, MODULE_STRING,
00163 psz_format, ap );
00164 va_end(ap);
00165 }
00166
00167 #else
00168
00169 # define msg_Info __msg_Info
00170 # define msg_Err __msg_Err
00171 # define msg_Warn __msg_Warn
00172 # define msg_Dbg __msg_Dbg
00173
00174 #endif
00175
00176 #define msg_Create(a) __msg_Create(VLC_OBJECT(a))
00177 #define msg_Flush(a) __msg_Flush(VLC_OBJECT(a))
00178 #define msg_Destroy(a) __msg_Destroy(VLC_OBJECT(a))
00179 void __msg_Create ( vlc_object_t * );
00180 void __msg_Flush ( vlc_object_t * );
00181 void __msg_Destroy ( vlc_object_t * );
00182
00183 #define msg_Subscribe(a) __msg_Subscribe(VLC_OBJECT(a))
00184 #define msg_Unsubscribe(a,b) __msg_Unsubscribe(VLC_OBJECT(a),b)
00185 VLC_EXPORT( msg_subscription_t*, __msg_Subscribe, ( vlc_object_t * ) );
00186 VLC_EXPORT( void, __msg_Unsubscribe, ( vlc_object_t *, msg_subscription_t * ) );
00187
00188