adding the code documentation guide lines
[mplayer/glamo.git] / mp_msg.h
blob368c257e6c3ba83576810b31d7acdeaeb744546b
2 #ifndef _MP_MSG_H
3 #define _MP_MSG_H
5 extern int verbose; // defined in mplayer.c
7 // verbosity elevel:
9 // stuff from level MSGL_FATAL-MSGL_HINT should be translated.
11 #define MSGL_FATAL 0 // will exit/abort
12 #define MSGL_ERR 1 // continues
13 #define MSGL_WARN 2 // only warning
14 #define MSGL_HINT 3 // short help message
15 #define MSGL_INFO 4 // -quiet
16 #define MSGL_STATUS 5 // v=0
17 #define MSGL_V 6 // v=1
18 #define MSGL_DBG2 7 // v=2
19 #define MSGL_DBG3 8 // v=3
20 #define MSGL_DBG4 9 // v=4
22 #define MSGL_FIXME 1 // for conversions from printf where the appropriate MSGL is not known; set equal to ERR for obtrusiveness
23 #define MSGT_FIXME 0 // for conversions from printf where the appropriate MSGT is not known; set equal to GLOBAL for obtrusiveness
25 // code/module:
27 #define MSGT_GLOBAL 0 // common player stuff errors
28 #define MSGT_CPLAYER 1 // console player (mplayer.c)
29 #define MSGT_GPLAYER 2 // gui player
31 #define MSGT_VO 3 // libvo
32 #define MSGT_AO 4 // libao
34 #define MSGT_DEMUXER 5 // demuxer.c (general stuff)
35 #define MSGT_DS 6 // demux stream (add/read packet etc)
36 #define MSGT_DEMUX 7 // fileformat-specific stuff (demux_*.c)
37 #define MSGT_HEADER 8 // fileformat-specific header (*header.c)
39 #define MSGT_AVSYNC 9 // mplayer.c timer stuff
40 #define MSGT_AUTOQ 10 // mplayer.c auto-quality stuff
42 #define MSGT_CFGPARSER 11 // cfgparser.c
44 #define MSGT_DECAUDIO 12 // av decoder
45 #define MSGT_DECVIDEO 13
47 #define MSGT_SEEK 14 // seeking code
48 #define MSGT_WIN32 15 // win32 dll stuff
49 #define MSGT_OPEN 16 // open.c (stream opening)
50 #define MSGT_DVD 17 // open.c (DVD init/read/seek)
52 #define MSGT_PARSEES 18 // parse_es.c (mpeg stream parser)
53 #define MSGT_LIRC 19 // lirc_mp.c and input lirc driver
55 #define MSGT_STREAM 20 // stream.c
56 #define MSGT_CACHE 21 // cache2.c
58 #define MSGT_MENCODER 22
60 #define MSGT_XACODEC 23 // XAnim codecs
62 #define MSGT_TV 24 // TV input subsystem
64 #define MSGT_OSDEP 25 // OS Dependant parts (linux/ for now)
66 #define MSGT_SPUDEC 26 // spudec.c
68 #define MSGT_PLAYTREE 27 // Playtree handeling (playtree.c, playtreeparser.c)
70 #define MSGT_INPUT 28
72 #define MSGT_VFILTER 29
74 #define MSGT_OSD 30
76 #define MSGT_NETWORK 31
78 #define MSGT_CPUDETECT 32
80 #define MSGT_CODECCFG 33
82 #define MSGT_SWS 34
84 #define MSGT_VOBSUB 35
85 #define MSGT_SUBREADER 36
87 #define MSGT_AFILTER 37 // Audio filter messages
89 #define MSGT_NETST 38 // Netstream
91 #define MSGT_MUXER 39 // muxer layer
93 #define MSGT_MAX 64
95 void mp_msg_init();
96 void mp_msg_set_level(int verbose);
97 int mp_msg_test(int mod, int lev);
99 #include "config.h"
101 #ifdef TARGET_OS2
102 // va_start/vsnprintf seems to be broken under OS2 :(
103 #define mp_msg(mod,lev, fmt, args... ) do{if((lev)<=mp_msg_levels[mod]) printf( fmt, ## args );}while(0)
104 #define mp_dbg(mod,lev, args... )
105 #else
107 #ifdef USE_I18N
108 #include <libintl.h>
109 #include <locale.h>
110 #define mp_gettext(String) gettext(String)
111 #else
112 #define mp_gettext(String) String
113 #endif
115 #ifdef __GNUC__
116 void mp_msg_c( int x, const char *format, ... ) __attribute__ ((format (printf, 2, 3)));
117 #define mp_msg(mod,lev, args... ) mp_msg_c(((mod)<<8)|(lev), ## args )
119 #ifdef MP_DEBUG
120 #define mp_dbg(mod,lev, args... ) mp_msg_c(((mod)<<8)|(lev), ## args )
121 #else
122 // these messages are only usefull for developers, disable them
123 #define mp_dbg(mod,lev, args... )
124 #endif
125 #else // not GNU C
126 void mp_msg_c( int x, const char *format, ... );
127 #define mp_msg(mod,lev, ... ) mp_msg_c(((mod)<<8)|(lev), __VA_ARGS__)
129 #ifdef MP_DEBUG
130 #define mp_dbg(mod,lev, ... ) mp_msg_c(((mod)<<8)|(lev), __VA_ARGS__)
131 #else
132 // these messages are only usefull for developers, disable them
133 #define mp_dbg(mod,lev, ... )
134 #endif
135 #endif
137 #endif
138 #endif