comparison mp_msg.c @ 16379:cdd8c0dfc19b

improve colorization
author michael
date Sat, 03 Sep 2005 19:27:48 +0000
parents e2e231134056
children bad73cd81b23
comparison
equal deleted inserted replaced
16378:430ca60471ba 16379:cdd8c0dfc19b
74 guiMessageBox(x&255, tmp); 74 guiMessageBox(x&255, tmp);
75 #endif 75 #endif
76 76
77 #ifdef MSG_USE_COLORS 77 #ifdef MSG_USE_COLORS
78 /* that's only a silly color test */ 78 /* that's only a silly color test */
79 #ifdef MP_DEBUG 79 #ifdef MP_ANNOY_ME
80 { int c; 80 { int c;
81 static int flag=1; 81 static int flag=1;
82 if(flag) 82 if(flag)
83 for(c=0;c<16;c++) 83 for(c=0;c<24;c++)
84 printf("\033[%d;3%dm*** COLOR TEST %d ***\n",(c>7),c&7,c); 84 printf("\033[%d;3%dm*** COLOR TEST %d ***\n",(c>7),c&7,c);
85 flag=0; 85 flag=0;
86 } 86 }
87 #endif 87 #endif
88 { unsigned char v_colors[10]={9,9,11,14,15,7,6,5,5,5}; 88 { unsigned char v_colors[10]={9,1,3,15,7,2,2,8,8,8};
89 static const char *lev_text[]= {
90 "FATAL",
91 "ERROR",
92 "WARN",
93 "HINT",
94 "INFO",
95 "STATUS",
96 "V",
97 "DGB2",
98 "DGB3",
99 "DGB4"};
100 static const char *mod_text[]= {
101 "GLOBAL",
102 "CPLAYER",
103 "GPLAYER",
104 "VIDEOOUT",
105 "AUDIOOUT",
106 "DEMUXER",
107 "DS",
108 "DEMUX",
109 "HEADER",
110 "AVSYNC",
111 "AUTOQ",
112 "CFGPARSER",
113 "DECAUDIO",
114 "DECVIDEO",
115 "SEEK",
116 "WIN32",
117 "OPEN",
118 "DVD",
119 "PARSEES",
120 "LIRC",
121 "STREAM",
122 "CACHE",
123 "MENCODER",
124 "XACODEC",
125 "TV",
126 "OSDEP",
127 "SPUDEC",
128 "PLAYTREE",
129 "INPUT",
130 "VFILTER",
131 "OSD",
132 "NETWORK",
133 "CPUDETECT",
134 "CODECCFG",
135 "SWS",
136 "VOBSUB",
137 "SUBREADER",
138 "AFILTER",
139 "NETST",
140 "MUXER"};
141
89 int c=v_colors[(x & 255)]; 142 int c=v_colors[(x & 255)];
90 fprintf(((x & 255) <= MSGL_WARN)?stderr:stdout, "\033[%d;3%dm",(c>7),c&7); 143 int c2=((x>>8)+1)%15+1;
144 static int header=1;
145 FILE *stream= (x & 255) <= MSGL_WARN ? stderr : stdout;
146 if(header){
147 fprintf(stream, "\033[%d;3%dm%9s\033[0;37m: ",c2>>3,c2&7, mod_text[x>>8]);
148 }
149 fprintf(stream, "\033[%d;3%dm",c>>3,c&7);
150 header= tmp[strlen(tmp)-1] == '\n'
151 /*||tmp[strlen(tmp)-1] == '\r'*/;
91 } 152 }
92 #endif 153 #endif
93 if ((x & 255) <= MSGL_WARN){ 154 if ((x & 255) <= MSGL_WARN){
94 fprintf(stderr, "%s", tmp);fflush(stderr); 155 fprintf(stderr, "%s", tmp);fflush(stderr);
95 } else { 156 } else {