//#define MSG_USE_COLORS #include #include #include #include #include "config.h" #ifdef USE_LANGINFO #include #include #endif #ifdef USE_ICONV #include #endif #if defined(FOR_MENCODER) || defined(CODECS2HTML) #undef HAVE_NEW_GUI #endif #ifdef HAVE_NEW_GUI #include "Gui/interface.h" extern int use_gui; #endif #include "mp_msg.h" /* maximum message length of mp_msg */ #define MSGSIZE_MAX 3072 int mp_msg_levels[MSGT_MAX]; // verbose level of this module. inited to -2 int mp_msg_level_all = MSGL_STATUS; int verbose = 0; #ifdef USE_ICONV char *mp_msg_charset = NULL; static char *old_charset = NULL; static iconv_t msgiconv; #endif void mp_msg_init(void){ int i; char *env = getenv("MPLAYER_VERBOSE"); if (env) verbose = atoi(env); for(i=0;i7),c&7,c); flag=0; } #endif { unsigned char v_colors[10]={9,1,3,15,7,2,2,8,8,8}; static const char *lev_text[]= { "FATAL", "ERROR", "WARN", "HINT", "INFO", "STATUS", "V", "DGB2", "DGB3", "DGB4"}; static const char *mod_text[]= { "GLOBAL", "CPLAYER", "GPLAYER", "VIDEOOUT", "AUDIOOUT", "DEMUXER", "DS", "DEMUX", "HEADER", "AVSYNC", "AUTOQ", "CFGPARSER", "DECAUDIO", "DECVIDEO", "SEEK", "WIN32", "OPEN", "DVD", "PARSEES", "LIRC", "STREAM", "CACHE", "MENCODER", "XACODEC", "TV", "OSDEP", "SPUDEC", "PLAYTREE", "INPUT", "VFILTER", "OSD", "NETWORK", "CPUDETECT", "CODECCFG", "SWS", "VOBSUB", "SUBREADER", "AFILTER", "NETST", "MUXER"}; int c=v_colors[lev]; int c2=(mod+1)%15+1; static int header=1; FILE *stream= (lev) <= MSGL_WARN ? stderr : stdout; if(header){ fprintf(stream, "\033[%d;3%dm%9s\033[0;37m: ",c2>>3,c2&7, mod_text[mod]); } fprintf(stream, "\033[%d;3%dm",c>>3,c&7); header= tmp[strlen(tmp)-1] == '\n' ||tmp[strlen(tmp)-1] == '\r'; } #endif if (lev <= MSGL_WARN){ fprintf(stderr, "%s", tmp);fflush(stderr); } else { printf("%s", tmp);fflush(stdout); } }