Commit f406134a authored by Gildas Bazin's avatar Gildas Bazin

- Added command line option '--stdout <filename>' which redirects stdout
    and stderr to the specified file. This option should mainly be useful
    on Win32.
- On Win32, vlc now has an icon associated to the .exe file, and is a full
    GUI application (you don't have this annoying dos command box anymore)
- Added INSTALL-win32.txt for specific details to the Win32 port.

I've tested these changes on Win32 and Linux, let's hope I didn't break
  vlc for other platforms.

--
Gildas
parent 0967faf5
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.
...@@ -64,6 +64,10 @@ ifneq (,$(findstring darwin,$(SYS))) ...@@ -64,6 +64,10 @@ ifneq (,$(findstring darwin,$(SYS)))
C_OBJ += src/misc/darwin_specific.o C_OBJ += src/misc/darwin_specific.o
endif endif
ifneq (,$(findstring mingw32,$(SYS)))
RESOURCE_OBJ := share/vlc_win32_rc.o
endif
# #
# Generated header # Generated header
# #
...@@ -318,11 +322,17 @@ $(CPP_OBJ): %.o: .dep/%.dpp ...@@ -318,11 +322,17 @@ $(CPP_OBJ): %.o: .dep/%.dpp
$(CPP_OBJ): %.o: %.cpp $(CPP_OBJ): %.o: %.cpp
$(CC) $(CFLAGS) -c -o $@ $< $(CC) $(CFLAGS) -c -o $@ $<
$(RESOURCE_OBJ): %.o: Makefile.dep Makefile
ifneq (,(findstring mingw32,$(SYS)))
$(RESOURCE_OBJ): %.o: %.rc
$(WINDRES) -i $< -o $@
endif
# #
# Main application target # Main application target
# #
vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
$(CC) $(CFLAGS) -o $@ $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(LCFLAGS) $(LIB) $(CC) $(CFLAGS) -o $@ $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ) $(LCFLAGS) $(LIB)
ifeq ($(SYS),beos) ifeq ($(SYS),beos)
xres -o $@ ./share/vlc_beos.rsrc xres -o $@ ./share/vlc_beos.rsrc
mimeset -f $@ mimeset -f $@
......
...@@ -243,7 +243,7 @@ LCFLAGS += @LCFLAGS@ $(LIB) ...@@ -243,7 +243,7 @@ LCFLAGS += @LCFLAGS@ $(LIB)
LCFLAGS += -Wall LCFLAGS += -Wall
#LCFLAGS += -s #LCFLAGS += -s
ifneq (,$(findstring mingw32,$(SYS))) ifneq (,$(findstring mingw32,$(SYS)))
LCFLAGS += -Xlinker --force-exe-suffix LCFLAGS += -mwindows -Xlinker --force-exe-suffix
endif endif
# #
......
...@@ -147,6 +147,10 @@ ...@@ -147,6 +147,10 @@
#define INTF_PATH_VAR "vlc_search_path" #define INTF_PATH_VAR "vlc_search_path"
#define INTF_PATH_DEFAULT "" #define INTF_PATH_DEFAULT ""
/* Environment variable containing the standard output method */
#define INTF_STDOUT_VAR "vlc_stdout"
#define INTF_STDOUT_DEFAULT ""
/***************************************************************************** /*****************************************************************************
* Input thread configuration * Input thread configuration
*****************************************************************************/ *****************************************************************************/
......
VLC_ICON ICON "share/gvlc_win32.ico"
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* and spawn threads. * and spawn threads.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * 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> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -59,6 +59,8 @@ ...@@ -59,6 +59,8 @@
#include <errno.h> /* ENOMEM */ #include <errno.h> /* ENOMEM */
#include <stdlib.h> /* getenv(), strtol(), */ #include <stdlib.h> /* getenv(), strtol(), */
#include <string.h> /* strerror() */ #include <string.h> /* strerror() */
#include <fcntl.h> /* open(), O_WRONLY */
#include <sys/stat.h> /* S_IREAD */
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
...@@ -127,6 +129,7 @@ ...@@ -127,6 +129,7 @@
#define OPT_SYNCHRO 190 #define OPT_SYNCHRO 190
#define OPT_WARNING 191 #define OPT_WARNING 191
#define OPT_VERSION 192 #define OPT_VERSION 192
#define OPT_STDOUT 193
/* Usage fashion */ /* Usage fashion */
#define USAGE 0 #define USAGE 0
...@@ -156,6 +159,7 @@ static const struct option longopts[] = ...@@ -156,6 +159,7 @@ static const struct option longopts[] =
/* Interface options */ /* Interface options */
{ "intf", 1, 0, 'I' }, { "intf", 1, 0, 'I' },
{ "warning", 1, 0, OPT_WARNING }, { "warning", 1, 0, OPT_WARNING },
{ "stdout", 1, 0, OPT_STDOUT },
/* Audio options */ /* Audio options */
{ "noaudio", 0, 0, OPT_NOAUDIO }, { "noaudio", 0, 0, OPT_NOAUDIO },
...@@ -226,6 +230,10 @@ static void SimpleSignalHandler ( int i_signal ); ...@@ -226,6 +230,10 @@ static void SimpleSignalHandler ( int i_signal );
static void FatalSignalHandler ( int i_signal ); static void FatalSignalHandler ( int i_signal );
static void InstructionSignalHandler( int i_signal ); static void InstructionSignalHandler( int i_signal );
static int CPUCapabilities ( void ); static int CPUCapabilities ( void );
static int RedirectSTDOUT ( void );
static void ShowConsole ( void );
static jmp_buf env; static jmp_buf env;
static int i_illegal; static int i_illegal;
...@@ -299,6 +307,12 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -299,6 +307,12 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
return( errno ); 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 * Initialize playlist and get commandline files
*/ */
...@@ -558,15 +572,48 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -558,15 +572,48 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
{ {
/* General/common options */ /* General/common options */
case 'h': /* -h, --help */ case 'h': /* -h, --help */
ShowConsole();
RedirectSTDOUT();
Usage( SHORT_HELP ); 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 ); return( -1 );
break; break;
case 'H': /* -H, --longhelp */ case 'H': /* -H, --longhelp */
ShowConsole();
RedirectSTDOUT();
Usage( LONG_HELP ); 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 ); return( -1 );
break; break;
case OPT_VERSION: /* --version */ case OPT_VERSION: /* --version */
ShowConsole();
RedirectSTDOUT();
Version(); 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 ); return( -1 );
break; break;
case 'v': /* -v, --verbose */ case 'v': /* -v, --verbose */
...@@ -582,6 +629,10 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -582,6 +629,10 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
p_main->i_warning_level = atoi(optarg); p_main->i_warning_level = atoi(optarg);
break; break;
case OPT_STDOUT: /* --stdout */
main_PutPszVariable( INTF_STDOUT_VAR, optarg );
break;
/* Audio options */ /* Audio options */
case OPT_NOAUDIO: /* --noaudio */ case OPT_NOAUDIO: /* --noaudio */
p_main->b_audio = 0; p_main->b_audio = 0;
...@@ -598,7 +649,7 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -598,7 +649,7 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
case OPT_SPDIF: /* --spdif */ case OPT_SPDIF: /* --spdif */
main_PutIntVariable( AOUT_SPDIF_VAR, 1 ); main_PutIntVariable( AOUT_SPDIF_VAR, 1 );
break; break;
case OPT_DOWNMIX: /* --downmix */ case OPT_DOWNMIX: /* --downmix */
main_PutPszVariable( DOWNMIX_METHOD_VAR, optarg ); main_PutPszVariable( DOWNMIX_METHOD_VAR, optarg );
break; break;
case OPT_IMDCT: /* --imdct */ case OPT_IMDCT: /* --imdct */
...@@ -696,9 +747,20 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -696,9 +747,20 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
/* Internal error: unknown option */ /* Internal error: unknown option */
case '?': case '?':
default: default:
ShowConsole();
RedirectSTDOUT();
intf_ErrMsg( "intf error: unknown option `%s'", intf_ErrMsg( "intf error: unknown option `%s'",
ppsz_argv[optind - 1] ); ppsz_argv[optind - 1] );
Usage( USAGE ); 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 ); return( EINVAL );
break; break;
} }
...@@ -753,6 +815,7 @@ static void Usage( int i_fashion ) ...@@ -753,6 +815,7 @@ static void Usage( int i_fashion )
intf_MsgImm( "\nOptions:" intf_MsgImm( "\nOptions:"
"\n -I, --intf <module> \tinterface method" "\n -I, --intf <module> \tinterface method"
"\n -v, --verbose \tverbose mode (cumulative)" "\n -v, --verbose \tverbose mode (cumulative)"
"\n --stdout <filename> \tredirect console stdout"
"\n" "\n"
"\n --noaudio \tdisable audio" "\n --noaudio \tdisable audio"
"\n -A, --aout <module> \taudio output method" "\n -A, --aout <module> \taudio output method"
...@@ -796,9 +859,10 @@ static void Usage( int i_fashion ) ...@@ -796,9 +859,10 @@ static void Usage( int i_fashion )
/* Interface parameters */ /* Interface parameters */
intf_MsgImm( "\nInterface parameters:" intf_MsgImm( "\nInterface parameters:"
"\n " INTF_METHOD_VAR "=<method name> \tinterface method" "\n " INTF_METHOD_VAR "=<method name> \tinterface method"
"\n " INTF_INIT_SCRIPT_VAR "=<filename> \tinitialization script" "\n " INTF_INIT_SCRIPT_VAR "=<filename> \tinitialization script"
"\n " INTF_CHANNELS_VAR "=<filename> \tchannels list" ); "\n " INTF_CHANNELS_VAR "=<filename> \tchannels list"
"\n " INTF_STDOUT_VAR "=<filename> \tredirect console stdout" );
/* Audio parameters */ /* Audio parameters */
intf_MsgImm( "\nAudio parameters:" intf_MsgImm( "\nAudio parameters:"
...@@ -1104,3 +1168,57 @@ static int CPUCapabilities( void ) ...@@ -1104,3 +1168,57 @@ static int CPUCapabilities( void )
#endif #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;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment