[MPlayer-dev-eng] rfc, uniform labeling of messages?
Reynaldo H. Verdejo Pinochet
reynaldo at opendot.cl
Wed Apr 26 07:18:56 CEST 2006
Ok, there is a huge bunch of help messages prefixed in no known
form whatsoever but almost all they use some variation of [foobar],
[im this module]. etc. Well, even tho this could be a nono from the
start, attached patch makes all message have a prefix stating what
module they where generated from. just for you to see if it fits
your eyes. who knows, maybe we can put some order on the message
spitting chaos mplayer is.
Regards
Reynaldo
-------------- next part --------------
Index: mp_msg.h
===================================================================
RCS file: /cvsroot/mplayer/main/mp_msg.h,v
retrieving revision 1.42
diff -a -u -r1.42 mp_msg.h
--- mp_msg.h 24 Apr 2006 07:20:32 -0000 1.42
+++ mp_msg.h 26 Apr 2006 05:13:21 -0000
@@ -99,6 +99,8 @@
#define MSGT_MAX 64
+#define MSG_LABEL_LENGTH 12
+
void mp_msg_init(void);
int mp_msg_test(int mod, int lev);
Index: mp_msg.c
===================================================================
RCS file: /cvsroot/mplayer/main/mp_msg.c,v
retrieving revision 1.41
diff -a -u -r1.41 mp_msg.c
--- mp_msg.c 24 Apr 2006 07:20:32 -0000 1.41
+++ mp_msg.c 26 Apr 2006 05:13:22 -0000
@@ -38,6 +38,19 @@
static iconv_t msgiconv;
#endif
+char MSG_LABEL[][MSG_LABEL_LENGTH]=
+{
+ "GLOBAL","CPLAYER","GPLAYER","VO","AO",
+ "DEMUXER","DEMUX_FILE","DEMUX_STR","DEMUX_HDR","AVSYNC",
+ "AUTOQ","CFGPARSER","DECAUDIO","DECVIDEO","SEEK",
+ "WIN32","STR_OPEN","DVD","PARSE_PES","LIRC",
+ "STREAM","CACHE","MENCODER","XACODEC","TV",
+ "OSDEP","SPUDEC","PLAYTREE","INPUT","VFILTER",
+ "OSD","NETWORK","CPUDETECT","CODECCFG","SWS",
+ "VOBSUB","SUBREADER","AFILTER","NET_STR","MUXER",
+ "OSD_MENU","IDENTIFY"
+};
+
void mp_msg_init(void){
int i;
char *env = getenv("MPLAYER_VERBOSE");
@@ -65,7 +78,10 @@
void mp_msg(int mod, int lev, const char *format, ... ){
va_list va;
char tmp[MSGSIZE_MAX];
-
+ char label[MSG_LABEL_LENGTH+2];
+
+ snprintf(label, MSG_LABEL_LENGTH+2, "%-12s| ", MSG_LABEL[mod]);
+
if (!mp_msg_test(mod, lev)) return; // do not display
va_start(va, format);
vsnprintf(tmp, MSGSIZE_MAX, format, va);
@@ -187,8 +203,10 @@
}
#endif
if (lev <= MSGL_WARN){
+ fprintf(stderr, "%s", label);
fprintf(stderr, "%s", tmp);fflush(stderr);
} else {
+ printf("%s", label);
printf("%s", tmp);fflush(stdout);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20060426/2ff4fe63/attachment.pgp>
More information about the MPlayer-dev-eng
mailing list