annotate mp_msg.c @ 16429:84174804804b

Updates to NUT spec: 1. remove average_bitrate 2. add other_stream_header, for subtitles and metadata 3. add max_pts to index 4. index_ptr - a 64 bit integer to say the total length of all index packets 5. specify how to write "multiple" indexes 6. change forward_ptr behavior, starts right after forward_ptr, ends after checksum 7. remove stream_id <-> stream_class limitation. 8. time_base_nom must also be non zero. 9. rename time_base_nom and time_base_denom, now timebase means the length of a tick, not amounts of ticks 10. remove (old?) sample_rate_mul stuff. 11. specify what exactly the checksum covers. 12. specify that stream classes which have multiple streams must have an info packet.. (in new Semantic requirements section) 13. Rename 'timestamp' to pts. 14. Change date of draft... 15. Add myself to authors...
author ods15
date Fri, 09 Sep 2005 10:26:21 +0000
parents cdd8c0dfc19b
children bad73cd81b23
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7200
9a123ba671fd - warnings enabled for GUI mode
arpi
parents: 7195
diff changeset
1
9a123ba671fd - warnings enabled for GUI mode
arpi
parents: 7195
diff changeset
2 //#define MSG_USE_COLORS
1562
2caba2f48026 new message printing system
arpi
parents:
diff changeset
3
2caba2f48026 new message printing system
arpi
parents:
diff changeset
4 #include <stdio.h>
2caba2f48026 new message printing system
arpi
parents:
diff changeset
5 #include <stdlib.h>
2caba2f48026 new message printing system
arpi
parents:
diff changeset
6 #include <stdarg.h>
2caba2f48026 new message printing system
arpi
parents:
diff changeset
7
1925
633a7f0d72a4 add gui error handling jol.
pontscho
parents: 1566
diff changeset
8 #include "config.h"
633a7f0d72a4 add gui error handling jol.
pontscho
parents: 1566
diff changeset
9
8573
b2e4f9dab7ad codec-cfg cannot be built when the gui is enabled - it fails to link with a
jkeil
parents: 7205
diff changeset
10 #if defined(FOR_MENCODER) || defined(CODECS2HTML)
b2e4f9dab7ad codec-cfg cannot be built when the gui is enabled - it fails to link with a
jkeil
parents: 7205
diff changeset
11 #undef ENABLE_GUI_CODE
b2e4f9dab7ad codec-cfg cannot be built when the gui is enabled - it fails to link with a
jkeil
parents: 7205
diff changeset
12 #elif defined(HAVE_NEW_GUI)
b2e4f9dab7ad codec-cfg cannot be built when the gui is enabled - it fails to link with a
jkeil
parents: 7205
diff changeset
13 #define ENABLE_GUI_CODE HAVE_NEW_GUI
b2e4f9dab7ad codec-cfg cannot be built when the gui is enabled - it fails to link with a
jkeil
parents: 7205
diff changeset
14 #else
b2e4f9dab7ad codec-cfg cannot be built when the gui is enabled - it fails to link with a
jkeil
parents: 7205
diff changeset
15 #undef ENABLE_GUI_CODE
b2e4f9dab7ad codec-cfg cannot be built when the gui is enabled - it fails to link with a
jkeil
parents: 7205
diff changeset
16 #endif
b2e4f9dab7ad codec-cfg cannot be built when the gui is enabled - it fails to link with a
jkeil
parents: 7205
diff changeset
17
b2e4f9dab7ad codec-cfg cannot be built when the gui is enabled - it fails to link with a
jkeil
parents: 7205
diff changeset
18 #if ENABLE_GUI_CODE
16374
e2e231134056 Remove many annoying GTK includes in every compile line and remove GTK
ods15
parents: 14542
diff changeset
19 #include "Gui/interface.h"
1925
633a7f0d72a4 add gui error handling jol.
pontscho
parents: 1566
diff changeset
20 extern int use_gui;
633a7f0d72a4 add gui error handling jol.
pontscho
parents: 1566
diff changeset
21 #endif
1562
2caba2f48026 new message printing system
arpi
parents:
diff changeset
22 #include "mp_msg.h"
2caba2f48026 new message printing system
arpi
parents:
diff changeset
23
6306
786ab42c10be Extend maximum mp_msg message size, some translations need it or help message will be cutted.
atmos4
parents: 6048
diff changeset
24 /* maximum message length of mp_msg */
786ab42c10be Extend maximum mp_msg message size, some translations need it or help message will be cutted.
atmos4
parents: 6048
diff changeset
25 #define MSGSIZE_MAX 3072
786ab42c10be Extend maximum mp_msg message size, some translations need it or help message will be cutted.
atmos4
parents: 6048
diff changeset
26
1562
2caba2f48026 new message printing system
arpi
parents:
diff changeset
27 static int mp_msg_levels[MSGT_MAX]; // verbose level of this module
2caba2f48026 new message printing system
arpi
parents:
diff changeset
28
2caba2f48026 new message printing system
arpi
parents:
diff changeset
29 #if 1
2caba2f48026 new message printing system
arpi
parents:
diff changeset
30
5220
4afbe13150e6 splitted mp_msg_init and mp_msg_set_level and added i18n support to init
alex
parents: 5102
diff changeset
31 void mp_msg_init(){
4afbe13150e6 splitted mp_msg_init and mp_msg_set_level and added i18n support to init
alex
parents: 5102
diff changeset
32 #ifdef USE_I18N
10415
c1247b33c424 moved some annonying messages to debug mode only
alex
parents: 8573
diff changeset
33 #ifdef MP_DEBUG
5220
4afbe13150e6 splitted mp_msg_init and mp_msg_set_level and added i18n support to init
alex
parents: 5102
diff changeset
34 fprintf(stdout, "Using GNU internationalization\n");
4afbe13150e6 splitted mp_msg_init and mp_msg_set_level and added i18n support to init
alex
parents: 5102
diff changeset
35 fprintf(stdout, "Original domain: %s\n", textdomain(NULL));
4afbe13150e6 splitted mp_msg_init and mp_msg_set_level and added i18n support to init
alex
parents: 5102
diff changeset
36 fprintf(stdout, "Original dirname: %s\n", bindtextdomain(textdomain(NULL),NULL));
10415
c1247b33c424 moved some annonying messages to debug mode only
alex
parents: 8573
diff changeset
37 #endif
5220
4afbe13150e6 splitted mp_msg_init and mp_msg_set_level and added i18n support to init
alex
parents: 5102
diff changeset
38 bindtextdomain("mplayer", PREFIX"/share/locale");
4afbe13150e6 splitted mp_msg_init and mp_msg_set_level and added i18n support to init
alex
parents: 5102
diff changeset
39 textdomain("mplayer");
10415
c1247b33c424 moved some annonying messages to debug mode only
alex
parents: 8573
diff changeset
40 #ifdef MP_DEBUG
5220
4afbe13150e6 splitted mp_msg_init and mp_msg_set_level and added i18n support to init
alex
parents: 5102
diff changeset
41 fprintf(stdout, "Current domain: %s\n", textdomain(NULL));
10415
c1247b33c424 moved some annonying messages to debug mode only
alex
parents: 8573
diff changeset
42 fprintf(stdout, "Current dirname: %s\n\n", bindtextdomain(textdomain(NULL),NULL));
c1247b33c424 moved some annonying messages to debug mode only
alex
parents: 8573
diff changeset
43 #endif
5220
4afbe13150e6 splitted mp_msg_init and mp_msg_set_level and added i18n support to init
alex
parents: 5102
diff changeset
44 #endif
4afbe13150e6 splitted mp_msg_init and mp_msg_set_level and added i18n support to init
alex
parents: 5102
diff changeset
45 mp_msg_set_level(MSGL_STATUS);
4afbe13150e6 splitted mp_msg_init and mp_msg_set_level and added i18n support to init
alex
parents: 5102
diff changeset
46 }
4afbe13150e6 splitted mp_msg_init and mp_msg_set_level and added i18n support to init
alex
parents: 5102
diff changeset
47
4afbe13150e6 splitted mp_msg_init and mp_msg_set_level and added i18n support to init
alex
parents: 5102
diff changeset
48 void mp_msg_set_level(int verbose){
1562
2caba2f48026 new message printing system
arpi
parents:
diff changeset
49 int i;
2caba2f48026 new message printing system
arpi
parents:
diff changeset
50 for(i=0;i<MSGT_MAX;i++){
2caba2f48026 new message printing system
arpi
parents:
diff changeset
51 mp_msg_levels[i]=verbose;
2caba2f48026 new message printing system
arpi
parents:
diff changeset
52 }
2caba2f48026 new message printing system
arpi
parents:
diff changeset
53 }
2caba2f48026 new message printing system
arpi
parents:
diff changeset
54
7058
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6306
diff changeset
55 int mp_msg_test(int mod, int lev)
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6306
diff changeset
56 {
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6306
diff changeset
57 return lev <= mp_msg_levels[mod];
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6306
diff changeset
58 }
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6306
diff changeset
59
1562
2caba2f48026 new message printing system
arpi
parents:
diff changeset
60 void mp_msg_c( int x, const char *format, ... ){
5102
17f97ed8259e added i18n support
alex
parents: 4888
diff changeset
61 #if 1
17f97ed8259e added i18n support
alex
parents: 4888
diff changeset
62 va_list va;
6306
786ab42c10be Extend maximum mp_msg message size, some translations need it or help message will be cutted.
atmos4
parents: 6048
diff changeset
63 char tmp[MSGSIZE_MAX];
5102
17f97ed8259e added i18n support
alex
parents: 4888
diff changeset
64
17f97ed8259e added i18n support
alex
parents: 4888
diff changeset
65 if((x&255)>mp_msg_levels[x>>8]) return; // do not display
5286
30caf02c0eae 10l - va_start needs teh pointer to stack - not the translated message
arpi
parents: 5220
diff changeset
66 va_start(va, format);
6306
786ab42c10be Extend maximum mp_msg message size, some translations need it or help message will be cutted.
atmos4
parents: 6048
diff changeset
67 vsnprintf(tmp, MSGSIZE_MAX, mp_gettext(format), va);
7195
a5b2566f3c2b print only fatal/error/warning to stderr, others go to stdout
arpi
parents: 7058
diff changeset
68 va_end(va);
10853
1e04ac498440 force a new line if a message is very long
pl
parents: 10415
diff changeset
69 tmp[MSGSIZE_MAX-2] = '\n';
6306
786ab42c10be Extend maximum mp_msg message size, some translations need it or help message will be cutted.
atmos4
parents: 6048
diff changeset
70 tmp[MSGSIZE_MAX-1] = 0;
5102
17f97ed8259e added i18n support
alex
parents: 4888
diff changeset
71
8573
b2e4f9dab7ad codec-cfg cannot be built when the gui is enabled - it fails to link with a
jkeil
parents: 7205
diff changeset
72 #if ENABLE_GUI_CODE
5102
17f97ed8259e added i18n support
alex
parents: 4888
diff changeset
73 if(use_gui)
16374
e2e231134056 Remove many annoying GTK includes in every compile line and remove GTK
ods15
parents: 14542
diff changeset
74 guiMessageBox(x&255, tmp);
5102
17f97ed8259e added i18n support
alex
parents: 4888
diff changeset
75 #endif
17f97ed8259e added i18n support
alex
parents: 4888
diff changeset
76
7200
9a123ba671fd - warnings enabled for GUI mode
arpi
parents: 7195
diff changeset
77 #ifdef MSG_USE_COLORS
10415
c1247b33c424 moved some annonying messages to debug mode only
alex
parents: 8573
diff changeset
78 /* that's only a silly color test */
16379
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
79 #ifdef MP_ANNOY_ME
7200
9a123ba671fd - warnings enabled for GUI mode
arpi
parents: 7195
diff changeset
80 { int c;
9a123ba671fd - warnings enabled for GUI mode
arpi
parents: 7195
diff changeset
81 static int flag=1;
9a123ba671fd - warnings enabled for GUI mode
arpi
parents: 7195
diff changeset
82 if(flag)
16379
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
83 for(c=0;c<24;c++)
7200
9a123ba671fd - warnings enabled for GUI mode
arpi
parents: 7195
diff changeset
84 printf("\033[%d;3%dm*** COLOR TEST %d ***\n",(c>7),c&7,c);
9a123ba671fd - warnings enabled for GUI mode
arpi
parents: 7195
diff changeset
85 flag=0;
9a123ba671fd - warnings enabled for GUI mode
arpi
parents: 7195
diff changeset
86 }
9a123ba671fd - warnings enabled for GUI mode
arpi
parents: 7195
diff changeset
87 #endif
16379
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
88 { unsigned char v_colors[10]={9,1,3,15,7,2,2,8,8,8};
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
89 static const char *lev_text[]= {
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
90 "FATAL",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
91 "ERROR",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
92 "WARN",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
93 "HINT",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
94 "INFO",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
95 "STATUS",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
96 "V",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
97 "DGB2",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
98 "DGB3",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
99 "DGB4"};
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
100 static const char *mod_text[]= {
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
101 "GLOBAL",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
102 "CPLAYER",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
103 "GPLAYER",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
104 "VIDEOOUT",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
105 "AUDIOOUT",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
106 "DEMUXER",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
107 "DS",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
108 "DEMUX",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
109 "HEADER",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
110 "AVSYNC",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
111 "AUTOQ",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
112 "CFGPARSER",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
113 "DECAUDIO",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
114 "DECVIDEO",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
115 "SEEK",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
116 "WIN32",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
117 "OPEN",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
118 "DVD",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
119 "PARSEES",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
120 "LIRC",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
121 "STREAM",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
122 "CACHE",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
123 "MENCODER",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
124 "XACODEC",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
125 "TV",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
126 "OSDEP",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
127 "SPUDEC",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
128 "PLAYTREE",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
129 "INPUT",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
130 "VFILTER",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
131 "OSD",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
132 "NETWORK",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
133 "CPUDETECT",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
134 "CODECCFG",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
135 "SWS",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
136 "VOBSUB",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
137 "SUBREADER",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
138 "AFILTER",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
139 "NETST",
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
140 "MUXER"};
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
141
7200
9a123ba671fd - warnings enabled for GUI mode
arpi
parents: 7195
diff changeset
142 int c=v_colors[(x & 255)];
16379
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
143 int c2=((x>>8)+1)%15+1;
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
144 static int header=1;
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
145 FILE *stream= (x & 255) <= MSGL_WARN ? stderr : stdout;
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
146 if(header){
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
147 fprintf(stream, "\033[%d;3%dm%9s\033[0;37m: ",c2>>3,c2&7, mod_text[x>>8]);
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
148 }
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
149 fprintf(stream, "\033[%d;3%dm",c>>3,c&7);
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
150 header= tmp[strlen(tmp)-1] == '\n'
cdd8c0dfc19b improve colorization
michael
parents: 16374
diff changeset
151 /*||tmp[strlen(tmp)-1] == '\r'*/;
7200
9a123ba671fd - warnings enabled for GUI mode
arpi
parents: 7195
diff changeset
152 }
9a123ba671fd - warnings enabled for GUI mode
arpi
parents: 7195
diff changeset
153 #endif
7195
a5b2566f3c2b print only fatal/error/warning to stderr, others go to stdout
arpi
parents: 7058
diff changeset
154 if ((x & 255) <= MSGL_WARN){
a5b2566f3c2b print only fatal/error/warning to stderr, others go to stdout
arpi
parents: 7058
diff changeset
155 fprintf(stderr, "%s", tmp);fflush(stderr);
a5b2566f3c2b print only fatal/error/warning to stderr, others go to stdout
arpi
parents: 7058
diff changeset
156 } else {
a5b2566f3c2b print only fatal/error/warning to stderr, others go to stdout
arpi
parents: 7058
diff changeset
157 printf("%s", tmp);fflush(stdout);
a5b2566f3c2b print only fatal/error/warning to stderr, others go to stdout
arpi
parents: 7058
diff changeset
158 }
7200
9a123ba671fd - warnings enabled for GUI mode
arpi
parents: 7195
diff changeset
159
5102
17f97ed8259e added i18n support
alex
parents: 4888
diff changeset
160 #else
1562
2caba2f48026 new message printing system
arpi
parents:
diff changeset
161 va_list va;
2caba2f48026 new message printing system
arpi
parents:
diff changeset
162 if((x&255)>mp_msg_levels[x>>8]) return; // do not display
2caba2f48026 new message printing system
arpi
parents:
diff changeset
163 va_start(va, format);
8573
b2e4f9dab7ad codec-cfg cannot be built when the gui is enabled - it fails to link with a
jkeil
parents: 7205
diff changeset
164 #if ENABLE_GUI_CODE
1971
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
165 if(use_gui){
3293
fc74fe43eb89 msg limit increased
arpi
parents: 1971
diff changeset
166 char tmp[16*80];
1971
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
167 vsnprintf( tmp,8*80,format,va ); tmp[8*80-1]=0;
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
168 switch( x&255 ) {
1925
633a7f0d72a4 add gui error handling jol.
pontscho
parents: 1566
diff changeset
169 case MSGL_FATAL:
633a7f0d72a4 add gui error handling jol.
pontscho
parents: 1566
diff changeset
170 fprintf( stderr,"%s",tmp );
3780
9eb4aa623ab6 fflush disappeared? .so?
arpi
parents: 3293
diff changeset
171 fflush(stderr);
1971
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
172 gtkMessageBox( GTK_MB_FATAL|GTK_MB_SIMPLE,tmp );
1925
633a7f0d72a4 add gui error handling jol.
pontscho
parents: 1566
diff changeset
173 break;
633a7f0d72a4 add gui error handling jol.
pontscho
parents: 1566
diff changeset
174 case MSGL_ERR:
633a7f0d72a4 add gui error handling jol.
pontscho
parents: 1566
diff changeset
175 fprintf( stderr,"%s",tmp );
3780
9eb4aa623ab6 fflush disappeared? .so?
arpi
parents: 3293
diff changeset
176 fflush(stderr);
1971
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
177 gtkMessageBox( GTK_MB_ERROR|GTK_MB_SIMPLE,tmp );
1925
633a7f0d72a4 add gui error handling jol.
pontscho
parents: 1566
diff changeset
178 break;
633a7f0d72a4 add gui error handling jol.
pontscho
parents: 1566
diff changeset
179 case MSGL_WARN:
4888
cb2adf32c356 Use stdout as default mencoder's output if no filename specified
nick
parents: 4176
diff changeset
180 fprintf( stderr, "%s",tmp );
3780
9eb4aa623ab6 fflush disappeared? .so?
arpi
parents: 3293
diff changeset
181 fflush(stdout);
1971
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
182 gtkMessageBox( GTK_MB_WARNING|GTK_MB_SIMPLE,tmp );
1925
633a7f0d72a4 add gui error handling jol.
pontscho
parents: 1566
diff changeset
183 break;
633a7f0d72a4 add gui error handling jol.
pontscho
parents: 1566
diff changeset
184 default:
4888
cb2adf32c356 Use stdout as default mencoder's output if no filename specified
nick
parents: 4176
diff changeset
185 fprintf(stderr, "%s",tmp );
3780
9eb4aa623ab6 fflush disappeared? .so?
arpi
parents: 3293
diff changeset
186 fflush(stdout);
1971
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
187 }
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
188 } else
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
189 #endif
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
190 if((x&255)<=MSGL_ERR){
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
191 // fprintf(stderr,"%%%%%% ");
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
192 vfprintf(stderr,format, va);
3780
9eb4aa623ab6 fflush disappeared? .so?
arpi
parents: 3293
diff changeset
193 fflush(stderr);
1971
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
194 } else {
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
195 // printf("%%%%%% ");
4888
cb2adf32c356 Use stdout as default mencoder's output if no filename specified
nick
parents: 4176
diff changeset
196 vfprintf(stderr,format, va);
3780
9eb4aa623ab6 fflush disappeared? .so?
arpi
parents: 3293
diff changeset
197 fflush(stdout);
1971
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
198 }
7d6116e415a3 cleanup
arpi
parents: 1934
diff changeset
199 va_end(va);
5102
17f97ed8259e added i18n support
alex
parents: 4888
diff changeset
200 #endif
1562
2caba2f48026 new message printing system
arpi
parents:
diff changeset
201 }
2caba2f48026 new message printing system
arpi
parents:
diff changeset
202
2caba2f48026 new message printing system
arpi
parents:
diff changeset
203 #else
2caba2f48026 new message printing system
arpi
parents:
diff changeset
204
2caba2f48026 new message printing system
arpi
parents:
diff changeset
205 FILE *mp_msg_file[MSGT_MAX]; // print message to this file (can be stdout/err)
2caba2f48026 new message printing system
arpi
parents:
diff changeset
206 static FILE* mp_msg_last_file=NULL;
2caba2f48026 new message printing system
arpi
parents:
diff changeset
207
2caba2f48026 new message printing system
arpi
parents:
diff changeset
208 // how to handle errors->stderr messages->stdout ?
2caba2f48026 new message printing system
arpi
parents:
diff changeset
209 void mp_msg( int x, const char *format, ... ){
2caba2f48026 new message printing system
arpi
parents:
diff changeset
210 if((x&255)>mp_msg_levels[x>>8] || !mp_msg_file[x>>8]) return; // do not display
2caba2f48026 new message printing system
arpi
parents:
diff changeset
211 va_list va;
2caba2f48026 new message printing system
arpi
parents:
diff changeset
212 va_start(va, format);
2caba2f48026 new message printing system
arpi
parents:
diff changeset
213 vfprintf(mp_msg_file[x>>8],format, va);
2caba2f48026 new message printing system
arpi
parents:
diff changeset
214 if(mp_msg_last_file!=mp_msg_file[x>>8]){
2caba2f48026 new message printing system
arpi
parents:
diff changeset
215 fflush(mp_msg_file[x>>8]);
2caba2f48026 new message printing system
arpi
parents:
diff changeset
216 mp_msg_last_file=mp_msg_file[x>>8];
2caba2f48026 new message printing system
arpi
parents:
diff changeset
217 }
2caba2f48026 new message printing system
arpi
parents:
diff changeset
218 va_end(va);
2caba2f48026 new message printing system
arpi
parents:
diff changeset
219 }
2caba2f48026 new message printing system
arpi
parents:
diff changeset
220
2caba2f48026 new message printing system
arpi
parents:
diff changeset
221 #endif