--- /dev/null
+INSTALL file for the Windows9x/2k version of vlc, the VideoLAN Client
+
+Running VideoLAN
+================
+
+If you have already built vlc (see below) or are using a binary release,
+just run 'vlc.exe'.
+
+You can also run vlc from a dos command box, in which case you'll be able
+to use the command line arguments. You can obtain a list of these command
+line arguments by typing 'vlc --help'.
+It is also sometimes useful to display vlc's debug console. You can do so
+by running 'vlc -v'.
+To store a debug log of the current vlc session, you can use
+'vlc -vvv --stdout=debug.txt'.
+
+If you want to play a DVD, run vlc and click on the Disc option in the
+interface. You then have to type your drive letter in the 'Device name'
+box (eg. 'D:' if your dvdrom drive is assigned the letter 'D').
+(Warning: you have to be in administrator mode (for now) on Win2k)
+
+
+Building VideoLAN from source code
+==================================
+
+If you want to do the tricky job of building vlc from source, follow
+these instructions:
+( WARNING: the win32 build process is not yet really stable, so you may have
+ to hack manually the MAKEFILES )
+
+Getting the right tools
+=======================
+
+You can build the win32 vlc port in two ways:
+- natively on Windows
+- or on Linux, using cross-compiling
+
+All these tools can be found on the libSDL web page:
+http://www.libsdl.org/Xmingw32/
+
+Configuring VideoLAN
+====================
+
+A typical way to configure vlc is:
+
+ ./configure --disable-x11 --disable-xvideo --disable-dsp --without-sdl \
+ --with-directx=/usr/local/cross-compile/i386-mingw32msvc
+
+See `./configure --help' for more information.
+
+To cross-compile for the Win32 platform using mingw32:
+
+ make distclean && CC=i586-mingw32msvc-gcc CFLAGS=-I/usr/i586-mingw32msvc \
+ RANLIB=i586-mingw32msvc-ranlib WINDRES=i586-mingw32msvc-windres \
+ ./configure --host=i386-mingw32msvc \
+ --target=i386-mingw32msvc --build=i386-linux --disable-dsp \
+ --disable-x11 --disable-xvideo
+
+
+Building VideoLAN
+=================
+
+Have a look at the generated Makefile.opts file, you may want to choose
+which modules will be compiled as plugins, and which ones will remain in
+the core application. The configure script tries to guess for you.
+
+Once configured, run `make' to build vlc.
+
+
+
+
+
+
+
+
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: main.c,v 1.105 2001/06/25 11:34:08 sam Exp $
+ * $Id: main.c,v 1.106 2001/06/27 06:29:59 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* getenv(), strtol(), */
#include <string.h> /* strerror() */
+#include <fcntl.h> /* open(), O_WRONLY */
+#include <sys/stat.h> /* S_IREAD */
#include "config.h"
#include "common.h"
#define OPT_SYNCHRO 190
#define OPT_WARNING 191
#define OPT_VERSION 192
+#define OPT_STDOUT 193
/* Usage fashion */
#define USAGE 0
/* Interface options */
{ "intf", 1, 0, 'I' },
{ "warning", 1, 0, OPT_WARNING },
+ { "stdout", 1, 0, OPT_STDOUT },
/* Audio options */
{ "noaudio", 0, 0, OPT_NOAUDIO },
static void FatalSignalHandler ( int i_signal );
static void InstructionSignalHandler( int i_signal );
static int CPUCapabilities ( void );
+
+static int RedirectSTDOUT ( void );
+static void ShowConsole ( void );
+
static jmp_buf env;
static int i_illegal;
return( errno );
}
+ /*
+ * Redirect the standard output if required by the user, and on Win32 we
+ * also open a console to display the debug messages.
+ */
+ RedirectSTDOUT();
+
/*
* Initialize playlist and get commandline files
*/
{
/* General/common options */
case 'h': /* -h, --help */
+ ShowConsole();
+ RedirectSTDOUT();
Usage( SHORT_HELP );
+#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
+ if( strcmp( "", main_GetPszVariable( INTF_STDOUT_VAR,
+ INTF_STDOUT_DEFAULT ) ) == 0 )
+ {
+ /* No stdout redirection has been asked for */
+ intf_MsgImm( "\nPress the RETURN key to continue..." );
+ getchar();
+ }
+#endif
return( -1 );
break;
case 'H': /* -H, --longhelp */
+ ShowConsole();
+ RedirectSTDOUT();
Usage( LONG_HELP );
+#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
+ if( strcmp( "", main_GetPszVariable( INTF_STDOUT_VAR,
+ INTF_STDOUT_DEFAULT ) ) == 0 )
+ {
+ /* No stdout redirection has been asked for */
+ intf_MsgImm( "\nPress the RETURN key to continue..." );
+ getchar();
+ }
+#endif
return( -1 );
break;
case OPT_VERSION: /* --version */
+ ShowConsole();
+ RedirectSTDOUT();
Version();
+#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
+ if( strcmp( "", main_GetPszVariable( INTF_STDOUT_VAR,
+ INTF_STDOUT_DEFAULT ) ) == 0 )
+ {
+ /* No stdout redirection has been asked for */
+ intf_MsgImm( "\nPress the RETURN key to continue..." );
+ getchar();
+ }
+#endif
return( -1 );
break;
case 'v': /* -v, --verbose */
p_main->i_warning_level = atoi(optarg);
break;
+ case OPT_STDOUT: /* --stdout */
+ main_PutPszVariable( INTF_STDOUT_VAR, optarg );
+ break;
+
/* Audio options */
case OPT_NOAUDIO: /* --noaudio */
p_main->b_audio = 0;
case OPT_SPDIF: /* --spdif */
main_PutIntVariable( AOUT_SPDIF_VAR, 1 );
break;
- case OPT_DOWNMIX: /* --downmix */
+ case OPT_DOWNMIX: /* --downmix */
main_PutPszVariable( DOWNMIX_METHOD_VAR, optarg );
break;
case OPT_IMDCT: /* --imdct */
/* Internal error: unknown option */
case '?':
default:
+ ShowConsole();
+ RedirectSTDOUT();
intf_ErrMsg( "intf error: unknown option `%s'",
ppsz_argv[optind - 1] );
Usage( USAGE );
+#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
+ if( strcmp( "", main_GetPszVariable( INTF_STDOUT_VAR,
+ INTF_STDOUT_DEFAULT ) ) == 0 )
+ {
+ /* No stdout redirection has been asked for */
+ intf_MsgImm( "\nPress the RETURN key to continue..." );
+ getchar();
+ }
+#endif
return( EINVAL );
break;
}
intf_MsgImm( "\nOptions:"
"\n -I, --intf <module> \tinterface method"
"\n -v, --verbose \tverbose mode (cumulative)"
+ "\n --stdout <filename> \tredirect console stdout"
"\n"
"\n --noaudio \tdisable audio"
"\n -A, --aout <module> \taudio output method"
/* Interface parameters */
intf_MsgImm( "\nInterface parameters:"
- "\n " INTF_METHOD_VAR "=<method name> \tinterface method"
- "\n " INTF_INIT_SCRIPT_VAR "=<filename> \tinitialization script"
- "\n " INTF_CHANNELS_VAR "=<filename> \tchannels list" );
+ "\n " INTF_METHOD_VAR "=<method name> \tinterface method"
+ "\n " INTF_INIT_SCRIPT_VAR "=<filename> \tinitialization script"
+ "\n " INTF_CHANNELS_VAR "=<filename> \tchannels list"
+ "\n " INTF_STDOUT_VAR "=<filename> \tredirect console stdout" );
/* Audio parameters */
intf_MsgImm( "\nAudio parameters:"
#endif
}
+/*****************************************************************************
+ * RedirectSTDOUT: redirect stdout and stderr to a file
+ *****************************************************************************
+ * This function will redirect stdout and stderr to a file if the user has
+ * specified so.
+ *****************************************************************************/
+static int RedirectSTDOUT( void )
+{
+ int i_stdout_filedesc;
+ char *psz_stdout_filename;
+
+ psz_stdout_filename = main_GetPszVariable( INTF_STDOUT_VAR,
+ INTF_STDOUT_DEFAULT );
+ if( strcmp( "", psz_stdout_filename ) != 0 )
+ {
+ ShowConsole();
+ i_stdout_filedesc = open( psz_stdout_filename,
+ O_CREAT | O_TRUNC | O_RDWR,
+ S_IREAD | S_IWRITE );
+ if( dup2( i_stdout_filedesc, fileno(stdout) ) == -1 )
+ intf_ErrMsg("Unable to redirect stdout!\n");
+ if( dup2( i_stdout_filedesc, fileno(stderr) ) == -1 )
+ intf_ErrMsg("Unable to redirect stderr!\n");
+ close( i_stdout_filedesc );
+ }
+ else
+ {
+ /* No stdout redirection has been asked so open a console */
+ if( p_main->i_warning_level )
+ {
+ ShowConsole();
+ }
+
+ }
+
+ return 0;
+}
+
+/*****************************************************************************
+ * ShowConsole: On Win32, create an output console for debug messages
+ *****************************************************************************
+ * This function is usefull only on Win32.
+ *****************************************************************************/
+static void ShowConsole( void )
+{
+#ifdef WIN32 /* */
+ AllocConsole();
+ freopen( "CONOUT$", "w", stdout );
+ freopen( "CONOUT$", "w", stderr );
+ freopen( "CONIN$", "r", stdin );
+#endif
+ return;
+}
+