1 /*****************************************************************************
2 * main.c: main vlc source
3 * Includes the main() function for vlc. Parses command line, start interface
5 *****************************************************************************
6 * Copyright (C) 1998-2001 VideoLAN
7 * $Id: main.c,v 1.195 2002/05/30 08:17:04 gbazin Exp $
9 * Authors: Vincent Seguin <seguin@via.ecp.fr>
10 * Samuel Hocevar <sam@zoy.org>
11 * Gildas Bazin <gbazin@netcourrier.com>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
26 *****************************************************************************/
28 /*****************************************************************************
30 *****************************************************************************/
31 #include <signal.h> /* SIGHUP, SIGINT, SIGKILL */
32 #include <stdio.h> /* sprintf() */
33 #include <setjmp.h> /* longjmp, setjmp */
35 #include <videolan/vlc.h>
37 #ifdef HAVE_GETOPT_LONG
39 # include <getopt.h> /* getopt() */
42 # include "GNUgetopt/getopt.h"
46 # include <mach/mach.h> /* Altivec detection */
47 # include <mach/mach_error.h> /* some day the header files||compiler *
48 will define it for us */
49 # include <mach/bootstrap.h>
53 # include <netinet/in.h> /* BSD: struct in_addr */
58 #elif defined( _MSC_VER ) && defined( _WIN32 )
66 #include <errno.h> /* ENOMEM */
67 #include <stdlib.h> /* getenv(), strtol(), */
68 #include <string.h> /* strerror() */
70 #include "netutils.h" /* network_ChannelJoin */
72 #include "stream_control.h"
73 #include "input_ext-intf.h"
75 #include "intf_playlist.h"
76 #include "interface.h"
78 #include "audio_output.h"
81 #include "video_output.h"
83 /*****************************************************************************
84 * Configuration options for the main program. Each module will also separatly
85 * define its own configuration options.
86 * Look into configuration.h if you need to know more about the following
89 *****************************************************************************/
91 #define MODULE_NAME main
92 #include "modules_inner.h" /* for configuration stuff */
95 #define INTF_TEXT N_("interface module")
96 #define INTF_LONGTEXT N_( \
97 "This option allows you to select the interface used by vlc.\nNote that " \
98 "the default behavior is to automatically select the best module " \
101 #define WARNING_TEXT N_("warning level (or use -v, -vv, etc...)")
102 #define WARNING_LONGTEXT N_( \
103 "Increasing the warning level will allow you to see more debug messages " \
104 "and can sometimes help you to troubleshoot a problem.")
106 #define STATS_TEXT N_("output statistics")
107 #define STATS_LONGTEXT N_( \
108 "Enabling the stats mode will flood your log console with various " \
109 "statistics messages.")
111 #define INTF_PATH_TEXT N_("interface default search path")
112 #define INTF_PATH_LONGTEXT N_( \
113 "This option allows you to set the default path that the interface will " \
114 "open when looking for a file.")
116 #define AOUT_TEXT N_("audio output module")
117 #define AOUT_LONGTEXT N_( \
118 "This option allows you to select the audio audio output method used by " \
119 "vlc.\nNote that the default behavior is to automatically select the " \
120 "best method available.")
122 #define AUDIO_TEXT N_("enable audio")
123 #define AUDIO_LONGTEXT N_( \
124 "You can completely disable the audio output. In this case the audio " \
125 "decoding stage won't be done, and it will also save some " \
128 #define MONO_TEXT N_("force mono audio")
129 #define MONO_LONGTEXT N_("This will force a mono audio output")
131 #define VOLUME_TEXT N_("audio output volume")
132 #define VOLUME_LONGTEXT N_( \
133 "You can set the default audio output volume here, in a range from 0 to " \
136 #define FORMAT_TEXT N_("audio output format")
137 #define FORMAT_LONGTEXT N_( \
138 "You can force the audio output format here.\n" \
139 "0 -> 16 bits signed native endian (default)\n" \
140 "1 -> 8 bits unsigned\n" \
141 "2 -> 16 bits signed little endian\n" \
142 "3 -> 16 bits signed big endian\n" \
143 "4 -> 8 bits signed\n" \
144 "5 -> 16 bits unsigned little endian\n" \
145 "6 -> 16 bits unsigned big endian\n" \
146 "7 -> mpeg2 audio (unsupported)\n" \
147 "8 -> ac3 pass-through")
149 #define RATE_TEXT N_("audio output frequency (Hz)")
150 #define RATE_LONGTEXT N_( \
151 "You can force the audio output frequency here.\nCommon values are " \
152 "48000, 44100, 32000, 22050, 16000, 11025, 8000.")
154 #define DESYNC_TEXT N_("compensate desynchronization of audio (in ms)")
155 #define DESYNC_LONGTEXT N_( \
156 "This option allows you to delay the audio output. This can be handy if " \
157 "you notice a lag between the video and the audio.")
159 #define VOUT_TEXT N_("video output module")
160 #define VOUT_LONGTEXT N_( \
161 "This option allows you to select the video output method used by vlc.\n" \
162 "Note that the default behavior is to automatically select the best " \
165 #define VIDEO_TEXT N_("enable video")
166 #define VIDEO_LONGTEXT N_( \
167 "You can completely disable the video output. In this case the video " \
168 "decoding stage won't be done, and it will also save some " \
171 #define DISPLAY_TEXT N_("display identifier")
172 #define DISPLAY_LONGTEXT N_( \
173 "This is the local display port that will be used for X11 drawing. " \
174 "For instance :0.1.")
176 #define WIDTH_TEXT N_("video width")
177 #define WIDTH_LONGTEXT N_( \
178 "You can enforce the video width here.\nNote that by default vlc will " \
179 "adapt to the video characteristics.")
181 #define HEIGHT_TEXT N_("video height")
182 #define HEIGHT_LONGTEXT N_( \
183 "You can enforce the video height here.\nNote that by default vlc will " \
184 "adapt to the video characteristics.")
186 #define ZOOM_TEXT N_("zoom video")
187 #define ZOOM_LONGTEXT N_( \
188 "You can zoom the video by the specified factor.")
190 #define GRAYSCALE_TEXT N_("grayscale video output")
191 #define GRAYSCALE_LONGTEXT N_( \
192 "When enabled, the color information from the video won't be decoded " \
193 "(this can also allow you to save some processing power).")
195 #define FULLSCREEN_TEXT N_("fullscreen video output")
196 #define FULLSCREEN_LONGTEXT N_( \
197 "If this option is enabled, vlc will always start a video in fullscreen " \
200 #define OVERLAY_TEXT N_("overlay video output")
201 #define OVERLAY_LONGTEXT N_( \
202 "If enabled, vlc will try to take advantage of the overlay capabilities " \
203 "of you graphics card.")
205 #define SPUMARGIN_TEXT N_("force SPU position")
206 #define SPUMARGIN_LONGTEXT N_( \
207 "You can use this option to place the sub-titles under the movie, " \
208 "instead of over the movie. Try several positions.")
210 #define FILTER_TEXT N_("video filter module")
211 #define FILTER_LONGTEXT N_( \
212 "This will allow you to add a post-processing filter to enhance the " \
213 "picture quality, for instance deinterlacing, or to clone or distort " \
216 #define SERVER_PORT_TEXT N_("server port")
217 #define SERVER_PORT_LONGTEXT N_( \
218 "This is the port used for UDP streams. By default, we chose 1234.")
220 #define NETCHANNEL_TEXT N_("enable network channel mode")
221 #define NETCHANNEL_LONGTEXT N_( \
222 "Activate this option if you want to use the VideoLAN Channel Server.")
224 #define CHAN_SERV_TEXT N_("channel server address")
225 #define CHAN_SERV_LONGTEXT N_( \
226 "Indicate here the address of the VideoLAN Channel Server.")
228 #define CHAN_PORT_TEXT N_("channel server port")
229 #define CHAN_PORT_LONGTEXT N_( \
230 "Indicate here the port on which the VideoLAN Channel Server runs.")
232 #define IFACE_TEXT N_("network interface")
233 #define IFACE_LONGTEXT N_( \
234 "If you have several interfaces on your Linux machine and use the " \
235 "VLAN solution, you may indicate here which interface to use.")
237 #define INPUT_PROGRAM_TEXT N_("choose program (SID)")
238 #define INPUT_PROGRAM_LONGTEXT N_( \
239 "Choose the program to select by giving its Service ID.")
241 #define INPUT_AUDIO_TEXT N_("choose audio")
242 #define INPUT_AUDIO_LONGTEXT N_( \
243 "Give the default type of audio you want to use in a DVD.")
245 #define INPUT_CHAN_TEXT N_("choose channel")
246 #define INPUT_CHAN_LONGTEXT N_( \
247 "Give the stream number of the audio channel you want to use in a DVD " \
250 #define INPUT_SUBT_TEXT N_("choose subtitles")
251 #define INPUT_SUBT_LONGTEXT N_( \
252 "Give the stream number of the subtitle channel you want to use in a DVD "\
255 #define DVD_DEV_TEXT N_("DVD device")
256 #define DVD_DEV_LONGTEXT N_( \
257 "This is the default DVD device to use.")
259 #define VCD_DEV_TEXT N_("VCD device")
260 #define VCD_DEV_LONGTEXT N_( \
261 "This is the default VCD device to use.")
263 #define IPV6_TEXT N_("force IPv6")
264 #define IPV6_LONGTEXT N_( \
265 "If you check this box, IPv6 will be used by default for all UDP and " \
268 #define IPV4_TEXT N_("force IPv4")
269 #define IPV4_LONGTEXT N_( \
270 "If you check this box, IPv4 will be used by default for all UDP and " \
273 #define ADEC_MPEG_TEXT N_("choose MPEG audio decoder")
274 #define ADEC_MPEG_LONGTEXT N_( \
275 "This allows you to select the MPEG audio decoder you want to use. " \
276 "Common choices are builtin and mad.")
278 #define ADEC_AC3_TEXT N_("choose AC3 audio decoder")
279 #define ADEC_AC3_LONGTEXT N_( \
280 "This allows you to select the AC3/A52 audio decoder you want to use. " \
281 "Common choices are builtin and a52.")
283 #define MMX_TEXT N_("enable CPU MMX support")
284 #define MMX_LONGTEXT N_( \
285 "If your processor supports the MMX instructions set, vlc can take " \
286 "advantage of them.")
288 #define THREE_DN_TEXT N_("enable CPU 3D Now! support")
289 #define THREE_DN_LONGTEXT N_( \
290 "If your processor supports the 3D Now! instructions set, vlc can take "\
291 "advantage of them.")
293 #define MMXEXT_TEXT N_("enable CPU MMX EXT support")
294 #define MMXEXT_LONGTEXT N_( \
295 "If your processor supports the MMX EXT instructions set, vlc can take "\
296 "advantage of them.")
298 #define SSE_TEXT N_("enable CPU SSE support")
299 #define SSE_LONGTEXT N_( \
300 "If your processor supports the SSE instructions set, vlc can take " \
301 "can take advantage of them.")
303 #define ALTIVEC_TEXT N_("enable CPU AltiVec support")
304 #define ALTIVEC_LONGTEXT N_( \
305 "If your processor supports the AltiVec instructions set, vlc can take "\
306 "advantage of them.")
308 #define PL_LAUNCH_TEXT N_("launch playlist on startup")
309 #define PL_LAUNCH_LONGTEXT N_( \
310 "If you want vlc to start playing on startup, then enable this option.")
312 #define PL_ENQUEUE_TEXT N_("enqueue items in playlist")
313 #define PL_ENQUEUE_LONGTEXT N_( \
314 "If you want vlc to add items to the playlist as you open them, then " \
315 "enable this option.")
317 #define PL_LOOP_TEXT N_("loop playlist on end")
318 #define PL_LOOP_LONGTEXT N_( \
319 "If you want vlc to keep playing the playlist indefinitely then enable " \
322 #define MEMCPY_TEXT N_("memory copy module")
323 #define MEMCPY_LONGTEXT N_( \
324 "You can select wich memory copy module you want to use. By default vlc " \
325 "will select the fastest one supported by your hardware.")
327 #define ACCESS_TEXT N_("access module")
328 #define ACCESS_LONGTEXT N_( \
329 "This is a legacy entry to let you configure access modules")
331 #define DEMUX_TEXT N_("demux module")
332 #define DEMUX_LONGTEXT N_( \
333 "This is a legacy entry to let you configure demux modules")
335 #define FAST_PTHREAD_TEXT N_("fast pthread on NT/2K/XP (developpers only)")
336 #define FAST_PTHREAD_LONGTEXT N_( \
337 "On Windows NT/2K/XP we use a slow but correct pthread implementation, " \
338 "you can also use this faster implementation but you might experience " \
342 * Quick usage guide for the configuration options:
344 * MODULE_CONFIG_START
346 * ADD_CATEGORY_HINT( N_(text), longtext )
347 * ADD_SUBCATEGORY_HINT( N_(text), longtext )
348 * ADD_STRING( option_name, value, p_callback, N_(text), N_(longtext) )
349 * ADD_FILE( option_name, psz_value, p_callback, N_(text), N_(longtext) )
350 * ADD_MODULE( option_name, psz_value, i_capability, p_callback,
351 * N_(text), N_(longtext) )
352 * ADD_INTEGER( option_name, i_value, p_callback, N_(text), N_(longtext) )
353 * ADD_BOOL( option_name, b_value, p_callback, N_(text), N_(longtext) )
358 /* Interface options */
359 ADD_CATEGORY_HINT( N_("Interface"), NULL)
360 ADD_MODULE_WITH_SHORT ( "intf", 'I', MODULE_CAPABILITY_INTF, NULL, NULL, INTF_TEXT, INTF_LONGTEXT )
361 ADD_INTEGER ( "warning", 0, NULL, WARNING_TEXT, WARNING_LONGTEXT )
362 ADD_BOOL ( "stats", 0, NULL, STATS_TEXT, STATS_LONGTEXT )
363 ADD_STRING ( "search-path", NULL, NULL, INTF_PATH_TEXT, INTF_PATH_LONGTEXT )
366 ADD_CATEGORY_HINT( N_("Audio"), NULL)
367 ADD_MODULE_WITH_SHORT ( "aout", 'A', MODULE_CAPABILITY_AOUT, NULL, NULL, AOUT_TEXT, AOUT_LONGTEXT )
368 ADD_BOOL ( "audio", 1, NULL, AUDIO_TEXT, AUDIO_LONGTEXT )
369 ADD_BOOL ( "mono", 0, NULL, MONO_TEXT, MONO_LONGTEXT )
370 ADD_INTEGER ( "volume", VOLUME_DEFAULT, NULL, VOLUME_TEXT, VOLUME_LONGTEXT )
371 ADD_INTEGER ( "rate", 44100, NULL, RATE_TEXT, RATE_LONGTEXT )
372 ADD_INTEGER ( "desync", 0, NULL, DESYNC_TEXT, DESYNC_LONGTEXT )
373 ADD_INTEGER ( "audio-format", 0, NULL, FORMAT_TEXT, FORMAT_LONGTEXT )
376 ADD_CATEGORY_HINT( N_("Video"), NULL )
377 ADD_MODULE_WITH_SHORT ( "vout", 'V', MODULE_CAPABILITY_VOUT, NULL, NULL, VOUT_TEXT, VOUT_LONGTEXT )
378 ADD_BOOL ( "video", 1, NULL, VIDEO_TEXT, VIDEO_LONGTEXT )
379 ADD_INTEGER ( "width", -1, NULL, WIDTH_TEXT, WIDTH_LONGTEXT )
380 ADD_INTEGER ( "height", -1, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT )
381 ADD_FLOAT ( "zoom", 1, NULL, ZOOM_TEXT, ZOOM_LONGTEXT )
382 ADD_BOOL ( "grayscale", 0, NULL, GRAYSCALE_TEXT, GRAYSCALE_LONGTEXT )
383 ADD_BOOL ( "fullscreen", 0, NULL, FULLSCREEN_TEXT, FULLSCREEN_LONGTEXT )
384 ADD_BOOL ( "overlay", 1, NULL, OVERLAY_TEXT, OVERLAY_LONGTEXT )
385 ADD_INTEGER ( "spumargin", -1, NULL, SPUMARGIN_TEXT, SPUMARGIN_LONGTEXT )
386 ADD_MODULE ( "filter", MODULE_CAPABILITY_VOUT, NULL, NULL, FILTER_TEXT, FILTER_LONGTEXT )
389 ADD_CATEGORY_HINT( N_("Input"), NULL )
390 ADD_INTEGER ( "server-port", 1234, NULL, SERVER_PORT_TEXT, SERVER_PORT_LONGTEXT )
391 ADD_BOOL ( "network-channel", 0, NULL, NETCHANNEL_TEXT, NETCHANNEL_LONGTEXT )
392 ADD_STRING ( "channel-server", "localhost", NULL, CHAN_SERV_TEXT, CHAN_SERV_LONGTEXT )
393 ADD_INTEGER ( "channel-port", 6010, NULL, CHAN_PORT_TEXT, CHAN_PORT_LONGTEXT )
394 ADD_STRING ( "iface", "eth0", NULL, IFACE_TEXT, IFACE_LONGTEXT )
396 ADD_INTEGER ( "program", 0, NULL, INPUT_PROGRAM_TEXT, INPUT_PROGRAM_LONGTEXT )
397 ADD_INTEGER ( "audio-type", -1, NULL, INPUT_AUDIO_TEXT, INPUT_AUDIO_LONGTEXT )
398 ADD_INTEGER ( "audio-channel", -1, NULL, INPUT_CHAN_TEXT, INPUT_CHAN_LONGTEXT )
399 ADD_INTEGER ( "spu-channel", -1, NULL, INPUT_SUBT_TEXT, INPUT_SUBT_LONGTEXT )
401 ADD_STRING ( "dvd", DVD_DEVICE, NULL, DVD_DEV_TEXT, DVD_DEV_LONGTEXT )
402 ADD_STRING ( "vcd", VCD_DEVICE, NULL, VCD_DEV_TEXT, VCD_DEV_LONGTEXT )
404 ADD_BOOL_WITH_SHORT ( "ipv6", '6', 0, NULL, IPV6_TEXT, IPV6_LONGTEXT )
405 ADD_BOOL_WITH_SHORT ( "ipv4", '4', 0, NULL, IPV4_TEXT, IPV4_LONGTEXT )
407 /* Decoder options */
408 ADD_CATEGORY_HINT( N_("Decoders"), NULL )
409 ADD_MODULE ( "mpeg-adec", MODULE_CAPABILITY_DECODER, NULL, NULL, ADEC_MPEG_TEXT, ADEC_MPEG_LONGTEXT )
410 ADD_MODULE ( "ac3-adec", MODULE_CAPABILITY_DECODER, NULL, NULL, ADEC_AC3_TEXT, ADEC_AC3_LONGTEXT )
413 ADD_CATEGORY_HINT( N_("CPU"), NULL )
414 ADD_BOOL ( "mmx", 1, NULL, MMX_TEXT, MMX_LONGTEXT )
415 ADD_BOOL ( "3dn", 1, NULL, THREE_DN_TEXT, THREE_DN_LONGTEXT )
416 ADD_BOOL ( "mmxext", 1, NULL, MMXEXT_TEXT, MMXEXT_LONGTEXT )
417 ADD_BOOL ( "sse", 1, NULL, SSE_TEXT, SSE_LONGTEXT )
418 ADD_BOOL ( "altivec", 1, NULL, ALTIVEC_TEXT, ALTIVEC_LONGTEXT )
420 /* Playlist options */
421 ADD_CATEGORY_HINT( N_("Playlist"), NULL )
422 ADD_BOOL ( "launch-playlist", 0, NULL, PL_LAUNCH_TEXT, PL_LAUNCH_LONGTEXT )
423 ADD_BOOL ( "enqueue-playlist", 0, NULL, PL_ENQUEUE_TEXT, PL_ENQUEUE_LONGTEXT )
424 ADD_BOOL ( "loop-playlist", 0, NULL, PL_LOOP_TEXT, PL_LOOP_LONGTEXT )
427 ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
428 ADD_MODULE ( "memcpy", MODULE_CAPABILITY_MEMCPY, NULL, NULL, MEMCPY_TEXT, MEMCPY_LONGTEXT )
429 ADD_MODULE ( "access", MODULE_CAPABILITY_ACCESS, NULL, NULL, ACCESS_TEXT, ACCESS_LONGTEXT )
430 ADD_MODULE ( "demux", MODULE_CAPABILITY_DEMUX, NULL, NULL, DEMUX_TEXT, DEMUX_LONGTEXT )
433 ADD_BOOL ( "fast_pthread", 0, NULL, FAST_PTHREAD_TEXT, FAST_PTHREAD_LONGTEXT )
439 SET_DESCRIPTION( N_("main program") )
440 ADD_CAPABILITY( MAIN, 100/*whatever*/ )
443 MODULE_ACTIVATE_START
446 MODULE_DEACTIVATE_START
447 MODULE_DEACTIVATE_STOP
449 /* Hack for help options */
450 static module_t help_module;
451 static module_config_t p_help_config[] =
453 { MODULE_CONFIG_ITEM_BOOL, "help", 'h', N_("print help"),
454 NULL, NULL, 0, 0, NULL, NULL, 0 },
455 { MODULE_CONFIG_ITEM_BOOL, "longhelp", 'H', N_("print detailed help"),
456 NULL, NULL, 0, 0, NULL, NULL, 0 },
457 { MODULE_CONFIG_ITEM_BOOL, "list", 'l', N_("print a list of available "
458 "modules"), NULL, NULL, 0, 0, NULL, NULL, 0 },
459 { MODULE_CONFIG_ITEM_STRING, "module", 'p', N_("print help on module"),
460 NULL, NULL, 0, 0, NULL, &help_module.config_lock, 0 },
461 { MODULE_CONFIG_ITEM_BOOL, "version", '\0',
462 N_("print version information"), NULL, NULL, 0, 0, NULL, NULL, 0 },
463 { MODULE_CONFIG_HINT_END, NULL, '\0', NULL, NULL, NULL, 0, 0,
466 static module_t help_module = { "help", "help module", NULL, {NULL}, 0, {0}, 0,
467 NULL, p_help_config, {0},
468 sizeof(p_help_config)/sizeof(module_config_t),
469 sizeof(p_help_config)/sizeof(module_config_t)
473 /*****************************************************************************
475 *****************************************************************************/
477 /*****************************************************************************
478 * Global variables - these are the only ones, see main.h and modules.h
479 *****************************************************************************/
481 module_bank_t *p_module_bank;
482 input_bank_t *p_input_bank;
483 aout_bank_t *p_aout_bank;
484 vout_bank_t *p_vout_bank;
486 /*****************************************************************************
488 *****************************************************************************/
489 static int GetFilenames ( int i_argc, char *ppsz_argv[] );
490 static void Usage ( const char *psz_module_name );
491 static void ListModules ( void );
492 static void Version ( void );
494 static void InitSignalHandler ( void );
495 static void SimpleSignalHandler ( int i_signal );
496 static void FatalSignalHandler ( int i_signal );
497 static void IllegalSignalHandler ( int i_signal );
498 static u32 CPUCapabilities ( void );
501 static void ShowConsole ( void );
505 static int i_illegal;
506 static char *psz_capability;
508 /*****************************************************************************
509 * main: parse command line, start interface and spawn threads
510 *****************************************************************************
511 * Steps during program execution are:
512 * -configuration parsing and messages interface initialization
513 * -opening of audio output device and some global modules
514 * -execution of interface, which exit on error or on user request
515 * -closing of audio output device and some global modules
516 * On error, the spawned threads are canceled, and the open devices closed.
517 *****************************************************************************/
518 int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
520 main_t main_data; /* root of all data - see main.h */
521 module_bank_t module_bank;
522 input_bank_t input_bank;
523 aout_bank_t aout_bank;
524 vout_bank_t vout_bank;
528 p_main = &main_data; /* set up the global variables */
529 p_module_bank = &module_bank;
530 p_input_bank = &input_bank;
531 p_aout_bank = &aout_bank;
532 p_vout_bank = &vout_bank;
534 p_main->i_warning_level = 0;
537 * Support for gettext
539 #if defined( ENABLE_NLS ) && defined ( HAVE_GETTEXT )
540 # if defined( HAVE_LOCALE_H ) && defined( HAVE_LC_MESSAGES )
541 if( !setlocale( LC_MESSAGES, "" ) )
543 fprintf( stderr, "warning: unsupported locale settings\n" );
546 setlocale( LC_CTYPE, "" );
549 if( !bindtextdomain( PACKAGE, LOCALEDIR ) )
551 fprintf( stderr, "warning: no domain %s in directory %s\n",
552 PACKAGE, LOCALEDIR );
555 textdomain( PACKAGE );
559 * Initialize threads system
564 * Test if our code is likely to run on this CPU
566 p_main->i_cpu_capabilities = CPUCapabilities();
569 * System specific initialization code
571 #if defined( SYS_BEOS ) || defined( SYS_DARWIN ) || defined( WIN32 )
572 system_Init( &i_argc, ppsz_argv, ppsz_env );
574 #elif defined( SYS_LINUX )
576 /* Activate malloc checking routines to detect heap corruptions. */
577 putenv( "MALLOC_CHECK_=2" );
578 putenv( "GNOME_DISABLE_CRASH_DIALOG=1" );
583 * Initialize messages interface
587 intf_Msg( COPYRIGHT_MESSAGE "\n" );
590 /* Get the executable name (similar to the basename command) */
593 p_main->psz_arg0 = p_tmp = ppsz_argv[ 0 ];
596 if( *p_tmp == '/' ) p_main->psz_arg0 = ++p_tmp;
602 p_main->psz_arg0 = "vlc";
606 * Initialize the module bank and and load the configuration of the main
607 * module. We need to do this at this stage to be able to display a short
608 * help if required by the user. (short help == main module options)
613 /* Hack: insert the help module here */
614 vlc_mutex_init( &help_module.config_lock );
615 help_module.next = p_module_bank->first;
616 p_module_bank->first = &help_module;
619 if( config_LoadCmdLine( &i_argc, ppsz_argv, 1 ) )
625 /* Check for short help option */
626 if( config_GetIntVariable( "help" ) )
628 intf_Msg( _("Usage: %s [options] [parameters] [file]...\n"),
636 /* Check for version option */
637 if( config_GetIntVariable( "version" ) )
643 /* Hack: remove the help module here */
644 p_module_bank->first = help_module.next;
648 * Load the builtins and plugins into the module_bank.
649 * We have to do it before config_Load*() because this also gets the
650 * list of configuration options exported by each module and loads their
653 module_LoadBuiltins();
654 module_LoadPlugins();
655 intf_WarnMsg( 2, "module: module bank initialized, found %i modules",
656 p_module_bank->i_count );
658 /* Hack: insert the help module here */
659 help_module.next = p_module_bank->first;
660 p_module_bank->first = &help_module;
663 /* Check for help on modules */
664 if( (p_tmp = config_GetPszVariable( "module" )) )
671 /* Check for long help option */
672 if( config_GetIntVariable( "longhelp" ) )
678 /* Check for module list option */
679 if( config_GetIntVariable( "list" ) )
685 /* Hack: remove the help module here */
686 p_module_bank->first = help_module.next;
691 * Override default configuration with config file settings
693 vlc_mutex_init( &p_main->config_lock );
694 p_main->psz_homedir = config_GetHomeDir();
695 config_LoadConfigFile( NULL );
698 * Override configuration with command line settings
700 if( config_LoadCmdLine( &i_argc, ppsz_argv, 0 ) )
704 /* Pause the console because it's destroyed when we exit */
705 intf_Msg( "The command line options couldn't be loaded, check that "
706 "they are valid.\nPress the RETURN key to continue..." );
715 * System specific configuration
719 /* p_main inititalization. FIXME ? */
720 p_main->i_warning_level = config_GetIntVariable( "warning" );
721 p_main->i_desync = config_GetIntVariable( "desync" ) * (mtime_t)1000;
722 p_main->b_stats = config_GetIntVariable( "stats" );
723 p_main->b_audio = config_GetIntVariable( "audio" );
724 p_main->b_stereo= !config_GetIntVariable( "mono" );
725 p_main->b_video = config_GetIntVariable( "video" );
726 if( !config_GetIntVariable( "mmx" ) )
727 p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_MMX;
728 if( !config_GetIntVariable( "3dn" ) )
729 p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_3DNOW;
730 if( !config_GetIntVariable( "mmxext" ) )
731 p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_MMXEXT;
732 if( !config_GetIntVariable( "sse" ) )
733 p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_SSE;
734 if( !config_GetIntVariable( "altivec" ) )
735 p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_ALTIVEC;
738 if( p_main->b_stats )
740 char p_capabilities[200];
741 p_capabilities[0] = '\0';
743 #define PRINT_CAPABILITY( capability, string ) \
744 if( p_main->i_cpu_capabilities & capability ) \
746 strncat( p_capabilities, string " ", \
747 sizeof(p_capabilities) - strlen(p_capabilities) ); \
748 p_capabilities[sizeof(p_capabilities) - 1] = '\0'; \
751 PRINT_CAPABILITY( CPU_CAPABILITY_486, "486" );
752 PRINT_CAPABILITY( CPU_CAPABILITY_586, "586" );
753 PRINT_CAPABILITY( CPU_CAPABILITY_PPRO, "Pentium Pro" );
754 PRINT_CAPABILITY( CPU_CAPABILITY_MMX, "MMX" );
755 PRINT_CAPABILITY( CPU_CAPABILITY_3DNOW, "3DNow!" );
756 PRINT_CAPABILITY( CPU_CAPABILITY_MMXEXT, "MMXEXT" );
757 PRINT_CAPABILITY( CPU_CAPABILITY_SSE, "SSE" );
758 PRINT_CAPABILITY( CPU_CAPABILITY_ALTIVEC, "Altivec" );
759 PRINT_CAPABILITY( CPU_CAPABILITY_FPU, "FPU" );
760 intf_StatMsg( "info: CPU has capabilities : %s", p_capabilities );
764 * Initialize playlist and get commandline files
766 p_main->p_playlist = intf_PlaylistCreate();
767 if( !p_main->p_playlist )
769 intf_ErrMsg( "playlist error: playlist initialization failed" );
773 intf_PlaylistInit( p_main->p_playlist );
776 * Get input filenames given as commandline arguments
778 GetFilenames( i_argc, ppsz_argv );
781 * Initialize input, aout and vout banks
788 * Choose the best memcpy module
790 psz_module = config_GetPszVariable( "memcpy" );
791 p_main->p_memcpy_module = module_Need( MODULE_CAPABILITY_MEMCPY,
793 if( psz_module ) free( psz_module );
794 if( p_main->p_memcpy_module == NULL )
796 intf_ErrMsg( "intf error: no suitable memcpy module, "
797 "using libc default" );
798 p_main->pf_memcpy = memcpy;
802 p_main->pf_memcpy = p_main->p_memcpy_module->p_functions
803 ->memcpy.functions.memcpy.pf_memcpy;
807 * Initialize shared resources and libraries
809 if( config_GetIntVariable( "network-channel" ) &&
810 network_ChannelCreate() )
812 /* On error during Channels initialization, switch off channels */
813 intf_ErrMsg( "intf error: channels initialization failed, "
814 "deactivating channels" );
815 config_PutIntVariable( "network-channel", 0 );
819 * Try to run the interface
821 p_main->p_intf = intf_Create();
822 if( p_main->p_intf == NULL )
824 intf_ErrMsg( "intf error: interface initialization failed" );
829 * Set signal handling policy for all threads
834 * This is the main loop
836 p_main->p_intf->pf_run( p_main->p_intf );
839 * Finished, destroy the interface
841 intf_Destroy( p_main->p_intf );
844 * Go back into channel 0 which is the network
846 if( config_GetIntVariable( "network-channel" ) && p_main->p_channel )
848 network_ChannelJoin( COMMON_CHANNEL );
853 * Free input, aout and vout banks
862 intf_PlaylistDestroy( p_main->p_playlist );
865 * Free allocated memory
867 if( p_main->p_memcpy_module != NULL )
869 module_Unneed( p_main->p_memcpy_module );
872 free( p_main->psz_homedir );
880 * System specific cleaning code
885 * Terminate messages interface and program
887 intf_WarnMsg( 1, "intf: program terminated" );
891 * Stop threads system
899 /* following functions are local */
901 /*****************************************************************************
902 * GetFilenames: parse command line options which are not flags
903 *****************************************************************************
904 * Parse command line for input files.
905 *****************************************************************************/
906 static int GetFilenames( int i_argc, char *ppsz_argv[] )
910 /* We assume that the remaining parameters are filenames */
911 for( i_opt = optind; i_opt < i_argc; i_opt++ )
913 intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END,
914 ppsz_argv[ i_opt ] );
920 /*****************************************************************************
921 * Usage: print program usage
922 *****************************************************************************
923 * Print a short inline help. Message interface is initialized at this stage.
924 *****************************************************************************/
925 static void Usage( const char *psz_module_name )
927 #define FORMAT_STRING " --%s%s%s%s%s%s %s%s"
928 /* option name prefix ------' | | | | | | |
929 * option name ---------------' | | | | | |
930 * <bra ------------------------' | | | | |
931 * option type or "" -------------' | | | |
932 * ket> ----------------------------' | | |
933 * padding spaces --------------------' | |
934 * comment ------------------------------' |
935 * comment suffix -------------------------'
937 * The purpose of having bra and ket is that we might i18n them as well.
940 #define PADDING_SPACES 25
942 module_config_t *p_item;
943 char psz_spaces[PADDING_SPACES+LINE_START+1];
944 char psz_format[sizeof(FORMAT_STRING)];
946 memset( psz_spaces, ' ', PADDING_SPACES+LINE_START );
947 psz_spaces[PADDING_SPACES+LINE_START] = '\0';
949 strcpy( psz_format, FORMAT_STRING );
955 /* Enumerate the config for each module */
956 for( p_module = p_module_bank->first ;
958 p_module = p_module->next )
960 boolean_t b_help_module = !strcmp( "help", p_module->psz_name );
962 if( psz_module_name && strcmp( psz_module_name, p_module->psz_name ) )
965 /* ignore modules without config options */
966 if( !p_module->i_config_items ) continue;
968 /* print module name */
969 intf_Msg( _("%s module options:\n"), p_module->psz_name );
971 for( p_item = p_module->p_config;
972 p_item->i_type != MODULE_CONFIG_HINT_END;
975 char *psz_bra = NULL, *psz_type = NULL, *psz_ket = NULL;
979 switch( p_item->i_type )
981 case MODULE_CONFIG_HINT_CATEGORY:
982 intf_Msg( " %s", p_item->psz_text );
985 case MODULE_CONFIG_ITEM_STRING:
986 case MODULE_CONFIG_ITEM_FILE:
987 case MODULE_CONFIG_ITEM_MODULE: /* We could also have "=<" here */
988 psz_bra = " <"; psz_type = _("string"); psz_ket = ">";
990 case MODULE_CONFIG_ITEM_INTEGER:
991 psz_bra = " <"; psz_type = _("integer"); psz_ket = ">";
993 case MODULE_CONFIG_ITEM_FLOAT:
994 psz_bra = " <"; psz_type = _("float"); psz_ket = ">";
996 case MODULE_CONFIG_ITEM_BOOL:
997 psz_bra = ""; psz_type = ""; psz_ket = "";
999 psz_suf = p_item->i_value ? _(" (default: enabled)") :
1000 _(" (default: disabled)");
1004 /* Add short option */
1005 if( p_item->i_short )
1007 psz_format[2] = '-';
1008 psz_format[3] = p_item->i_short;
1009 psz_format[4] = ',';
1013 psz_format[2] = ' ';
1014 psz_format[3] = ' ';
1015 psz_format[4] = ' ';
1020 i = PADDING_SPACES - strlen( p_item->psz_name )
1021 - strlen( psz_bra ) - strlen( psz_type )
1022 - strlen( psz_ket ) - 1;
1023 if( p_item->i_type == MODULE_CONFIG_ITEM_BOOL &&
1024 !b_help_module ) i -= 5;
1029 psz_spaces[i] = '\n';
1033 psz_spaces[i] = '\0';
1036 intf_Msg( psz_format,
1037 ( p_item->i_type == MODULE_CONFIG_ITEM_BOOL &&
1038 !b_help_module ) ? "(no-)" : "",
1039 p_item->psz_name, psz_bra, psz_type, psz_ket,
1040 psz_spaces, p_item->psz_text, psz_suf );
1041 psz_spaces[i] = ' ';
1045 /* Yet another nasty hack.
1046 * Maybe we could use MODULE_CONFIG_ITEM_END to display tail messages
1047 * for each module?? */
1048 if( !strcmp( "main", p_module->psz_name ) )
1050 intf_Msg( _("\nPlaylist items:"
1051 "\n *.mpg, *.vob plain MPEG-1/2 files"
1052 "\n [dvd:][device][@raw_device][@[title][,[chapter][,angle]]]"
1054 "\n [vcd:][device][@[title][,[chapter]]"
1056 "\n udpstream:[@[<bind address>][:<bind port>]]"
1057 "\n UDP stream sent by VLS"
1058 "\n vlc:loop loop execution of the "
1060 "\n vlc:pause pause execution of "
1062 "\n vlc:quit quit VLC") );
1069 #ifdef WIN32 /* Pause the console because it's destroyed when we exit */
1070 intf_Msg( _("\nPress the RETURN key to continue...") );
1075 /*****************************************************************************
1076 * ListModules: list the available modules with their description
1077 *****************************************************************************
1078 * Print a list of all available modules (builtins and plugins) and a short
1079 * description for each one.
1080 *****************************************************************************/
1081 static void ListModules( void )
1084 char psz_spaces[22];
1086 memset( psz_spaces, ' ', 22 );
1093 intf_Msg( _("Usage: %s [options] [parameters] [file]...\n"),
1096 intf_Msg( _("[module] [description]") );
1098 /* Enumerate each module */
1099 for( p_module = p_module_bank->first ;
1101 p_module = p_module->next )
1105 /* Nasty hack, but right now I'm too tired to think about a nice
1107 i = 22 - strlen( p_module->psz_name ) - 1;
1111 intf_Msg( " %s%s %s", p_module->psz_name, psz_spaces,
1112 p_module->psz_longname );
1114 psz_spaces[i] = ' ';
1118 #ifdef WIN32 /* Pause the console because it's destroyed when we exit */
1119 intf_Msg( _("\nPress the RETURN key to continue...") );
1124 /*****************************************************************************
1125 * Version: print complete program version
1126 *****************************************************************************
1127 * Print complete program version and build number.
1128 *****************************************************************************/
1129 static void Version( void )
1135 intf_Msg( VERSION_MESSAGE );
1137 _("This program comes with NO WARRANTY, to the extent permitted by "
1138 "law.\nYou may redistribute it under the terms of the GNU General "
1139 "Public License;\nsee the file named COPYING for details.\n"
1140 "Written by the VideoLAN team at Ecole Centrale, Paris.") );
1142 #ifdef WIN32 /* Pause the console because it's destroyed when we exit */
1143 intf_Msg( _("\nPress the RETURN key to continue...") );
1148 /*****************************************************************************
1149 * InitSignalHandler: system signal handler initialization
1150 *****************************************************************************
1151 * Set the signal handlers. SIGTERM is not intercepted, because we need at
1152 * at least a method to kill the program when all other methods failed, and
1153 * when we don't want to use SIGKILL.
1154 *****************************************************************************/
1155 static void InitSignalHandler( void )
1157 /* Termination signals */
1159 signal( SIGINT, FatalSignalHandler );
1160 signal( SIGHUP, FatalSignalHandler );
1161 signal( SIGQUIT, FatalSignalHandler );
1164 signal( SIGALRM, SimpleSignalHandler );
1165 signal( SIGPIPE, SimpleSignalHandler );
1169 /*****************************************************************************
1170 * SimpleSignalHandler: system signal handler
1171 *****************************************************************************
1172 * This function is called when a non fatal signal is received by the program.
1173 *****************************************************************************/
1174 static void SimpleSignalHandler( int i_signal )
1176 /* Acknowledge the signal received */
1177 intf_WarnMsg( 0, "intf: ignoring signal %d", i_signal );
1180 /*****************************************************************************
1181 * FatalSignalHandler: system signal handler
1182 *****************************************************************************
1183 * This function is called when a fatal signal is received by the program.
1184 * It tries to end the program in a clean way.
1185 *****************************************************************************/
1186 static void FatalSignalHandler( int i_signal )
1188 static mtime_t abort_time = 0;
1189 static volatile boolean_t b_die = 0;
1191 /* Once a signal has been trapped, the termination sequence will be
1192 * armed and following signals will be ignored to avoid sending messages
1193 * to an interface having been destroyed */
1197 abort_time = mdate();
1199 /* Acknowledge the signal received */
1200 intf_ErrMsg( "intf error: signal %d received, exiting - do it again "
1201 "if vlc gets stuck", i_signal );
1203 /* Try to terminate everything - this is done by requesting the end
1204 * of the interface thread */
1205 p_main->p_intf->b_die = 1;
1210 /* If user asks again 1 second later, die badly */
1211 if( mdate() > abort_time + 1000000 )
1214 signal( SIGINT, SIG_IGN );
1215 signal( SIGHUP, SIG_IGN );
1216 signal( SIGQUIT, SIG_IGN );
1219 intf_ErrMsg( "intf error: user insisted too much, dying badly" );
1224 /*****************************************************************************
1225 * IllegalSignalHandler: system signal handler
1226 *****************************************************************************
1227 * This function is called when an illegal instruction signal is received by
1228 * the program. We use this function to test OS and CPU capabilities
1229 *****************************************************************************/
1230 static void IllegalSignalHandler( int i_signal )
1232 /* Acknowledge the signal received */
1235 #ifdef HAVE_SIGRELSE
1236 sigrelse( i_signal );
1239 #if defined( __i386__ )
1240 fprintf( stderr, "warning: your CPU has %s instructions, but not your "
1241 "operating system.\n", psz_capability );
1242 fprintf( stderr, " some optimizations will be disabled unless "
1243 "you upgrade your OS\n" );
1244 # if defined( SYS_LINUX )
1245 fprintf( stderr, " (for instance Linux kernel 2.4.x or later)\n" );
1252 /*****************************************************************************
1253 * CPUCapabilities: list the processors MMX support and other capabilities
1254 *****************************************************************************
1255 * This function is called to list extensions the CPU may have.
1256 *****************************************************************************/
1257 static u32 CPUCapabilities( void )
1259 volatile u32 i_capabilities = CPU_CAPABILITY_NONE;
1261 #if defined( SYS_DARWIN )
1262 struct host_basic_info hi;
1264 host_name_port_t host;
1267 char *psz_name, *psz_subname;
1269 i_capabilities |= CPU_CAPABILITY_FPU;
1271 /* Should 'never' fail? */
1272 host = mach_host_self();
1274 i_size = sizeof( hi ) / sizeof( int );
1275 ret = host_info( host, HOST_BASIC_INFO, ( host_info_t )&hi, &i_size );
1277 if( ret != KERN_SUCCESS )
1279 fprintf( stderr, "error: couldn't get CPU information\n" );
1280 return( i_capabilities );
1283 slot_name( hi.cpu_type, hi.cpu_subtype, &psz_name, &psz_subname );
1284 /* FIXME: need better way to detect newer proccessors.
1285 * could do strncmp(a,b,5), but that's real ugly */
1286 if( !strcmp(psz_name, "ppc7400") || !strcmp(psz_name, "ppc7450") )
1288 i_capabilities |= CPU_CAPABILITY_ALTIVEC;
1291 return( i_capabilities );
1293 #elif defined( __i386__ )
1294 volatile unsigned int i_eax, i_ebx, i_ecx, i_edx;
1295 volatile boolean_t b_amd;
1297 /* Needed for x86 CPU capabilities detection */
1298 # define cpuid( a ) \
1299 asm volatile ( "pushl %%ebx\n\t" \
1301 "movl %%ebx,%1\n\t" \
1310 i_capabilities |= CPU_CAPABILITY_FPU;
1312 # if defined( CAN_COMPILE_SSE ) || defined ( CAN_COMPILE_3DNOW )
1313 signal( SIGILL, IllegalSignalHandler );
1316 /* test for a 486 CPU */
1317 asm volatile ( "pushl %%ebx\n\t"
1320 "movl %%eax, %%ebx\n\t"
1321 "xorl $0x200000, %%eax\n\t"
1333 if( i_eax == i_ebx )
1335 # if defined( CAN_COMPILE_SSE ) || defined ( CAN_COMPILE_3DNOW )
1336 signal( SIGILL, NULL );
1338 return( i_capabilities );
1341 i_capabilities |= CPU_CAPABILITY_486;
1343 /* the CPU supports the CPUID instruction - get its level */
1344 cpuid( 0x00000000 );
1348 # if defined( CAN_COMPILE_SSE ) || defined ( CAN_COMPILE_3DNOW )
1349 signal( SIGILL, NULL );
1351 return( i_capabilities );
1354 /* FIXME: this isn't correct, since some 486s have cpuid */
1355 i_capabilities |= CPU_CAPABILITY_586;
1357 /* borrowed from mpeg2dec */
1358 b_amd = ( i_ebx == 0x68747541 ) && ( i_ecx == 0x444d4163 )
1359 && ( i_edx == 0x69746e65 );
1361 /* test for the MMX flag */
1362 cpuid( 0x00000001 );
1364 if( ! (i_edx & 0x00800000) )
1366 # if defined( CAN_COMPILE_SSE ) || defined ( CAN_COMPILE_3DNOW )
1367 signal( SIGILL, NULL );
1369 return( i_capabilities );
1372 i_capabilities |= CPU_CAPABILITY_MMX;
1374 if( i_edx & 0x02000000 )
1376 i_capabilities |= CPU_CAPABILITY_MMXEXT;
1378 # ifdef CAN_COMPILE_SSE
1379 /* We test if OS supports the SSE instructions */
1380 psz_capability = "SSE";
1382 if( setjmp( env ) == 0 )
1384 /* Test a SSE instruction */
1385 __asm__ __volatile__ ( "xorps %%xmm0,%%xmm0\n" : : );
1388 if( i_illegal == 0 )
1390 i_capabilities |= CPU_CAPABILITY_SSE;
1395 /* test for additional capabilities */
1396 cpuid( 0x80000000 );
1398 if( i_eax < 0x80000001 )
1400 # if defined( CAN_COMPILE_SSE ) || defined ( CAN_COMPILE_3DNOW )
1401 signal( SIGILL, NULL );
1403 return( i_capabilities );
1406 /* list these additional capabilities */
1407 cpuid( 0x80000001 );
1409 # ifdef CAN_COMPILE_3DNOW
1410 if( i_edx & 0x80000000 )
1412 psz_capability = "3D Now!";
1414 if( setjmp( env ) == 0 )
1416 /* Test a 3D Now! instruction */
1417 __asm__ __volatile__ ( "pfadd %%mm0,%%mm0\n" "femms\n" : : );
1420 if( i_illegal == 0 )
1422 i_capabilities |= CPU_CAPABILITY_3DNOW;
1427 if( b_amd && ( i_edx & 0x00400000 ) )
1429 i_capabilities |= CPU_CAPABILITY_MMXEXT;
1432 # if defined( CAN_COMPILE_SSE ) || defined ( CAN_COMPILE_3DNOW )
1433 signal( SIGILL, NULL );
1435 return( i_capabilities );
1437 #elif defined( __powerpc__ )
1439 i_capabilities |= CPU_CAPABILITY_FPU;
1441 # ifdef CAN_COMPILE_ALTIVEC
1442 signal( SIGILL, IllegalSignalHandler );
1444 psz_capability = "AltiVec";
1446 if( setjmp( env ) == 0 )
1448 asm volatile ("mtspr 256, %0\n\t"
1449 "vand %%v0, %%v0, %%v0"
1454 if( i_illegal == 0 )
1456 i_capabilities |= CPU_CAPABILITY_ALTIVEC;
1459 signal( SIGILL, NULL );
1462 return( i_capabilities );
1464 #elif defined( __sparc__ )
1466 i_capabilities |= CPU_CAPABILITY_FPU;
1467 return( i_capabilities );
1470 /* default behaviour */
1471 return( i_capabilities );
1476 /*****************************************************************************
1477 * ShowConsole: On Win32, create an output console for debug messages
1478 *****************************************************************************
1479 * This function is useful only on Win32.
1480 *****************************************************************************/
1482 static void ShowConsole( void )
1485 freopen( "CONOUT$", "w", stdout );
1486 freopen( "CONOUT$", "w", stderr );
1487 freopen( "CONIN$", "r", stdin );