Commit 10afbf83 authored by Gildas Bazin's avatar Gildas Bazin

* src/extras/libc.c, nclude/vlc_common.h, modules/mux/mpeg/ts.c: added atoll() to our libc.

* modules/control/ntservice.c: added a --ntservice-extraintf option to allow the service to spawn additionnal interfaces.
* include/audio_output.h, modules/audio_output/directx.c: added support for 3F2R audio output in addition to 3F2R/LFE (5.1).
parent 0420ba2c
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* audio_output.h : audio output interface * audio_output.h : audio output interface
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: audio_output.h,v 1.81 2003/08/03 23:11:21 gbazin Exp $ * $Id: audio_output.h,v 1.82 2003/08/14 11:47:32 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -125,11 +125,12 @@ typedef int32_t vlc_fixed_t; ...@@ -125,11 +125,12 @@ typedef int32_t vlc_fixed_t;
/* Values used for the audio-device and audio-channels object variables */ /* Values used for the audio-device and audio-channels object variables */
#define AOUT_VAR_MONO 1 #define AOUT_VAR_MONO 1
#define AOUT_VAR_STEREO 2 #define AOUT_VAR_STEREO 2
#define AOUT_VAR_2F2R 3 #define AOUT_VAR_2F2R 4
#define AOUT_VAR_5_1 4 #define AOUT_VAR_3F2R 5
#define AOUT_VAR_6_1 5 #define AOUT_VAR_5_1 6
#define AOUT_VAR_7_1 6 #define AOUT_VAR_6_1 7
#define AOUT_VAR_SPDIF 7 #define AOUT_VAR_7_1 8
#define AOUT_VAR_SPDIF 10
#define AOUT_VAR_CHAN_STEREO 1 #define AOUT_VAR_CHAN_STEREO 1
#define AOUT_VAR_CHAN_RSTEREO 2 #define AOUT_VAR_CHAN_RSTEREO 2
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.71 2003/08/13 14:17:26 zorglub Exp $ * $Id: vlc_common.h,v 1.72 2003/08/14 11:47:32 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@via.ecp.fr> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -543,6 +543,13 @@ static inline uint64_t U64_AT( void * _p ) ...@@ -543,6 +543,13 @@ static inline uint64_t U64_AT( void * _p )
# define vlc_atof NULL # define vlc_atof NULL
#endif #endif
#ifndef HAVE_ATOLL
# define atoll vlc_atoll
VLC_EXPORT( int64_t, vlc_atoll, ( const char *nptr ) );
#elif !defined(__PLUGIN__)
# define vlc_atoll NULL
#endif
#ifndef HAVE_GETENV #ifndef HAVE_GETENV
# define getenv vlc_getenv # define getenv vlc_getenv
VLC_EXPORT( char *, vlc_getenv, ( const char *name ) ); VLC_EXPORT( char *, vlc_getenv, ( const char *name ) );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* directx.c: Windows DirectX audio output method * directx.c: Windows DirectX audio output method
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: directx.c,v 1.22 2003/07/11 23:14:03 gbazin Exp $ * $Id: directx.c,v 1.23 2003/08/14 11:47:32 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -307,6 +307,12 @@ static int OpenAudio( vlc_object_t *p_this ) ...@@ -307,6 +307,12 @@ static int OpenAudio( vlc_object_t *p_this )
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT
| AOUT_CHAN_LFE; | AOUT_CHAN_LFE;
} }
else if( val.i_int == AOUT_VAR_3F2R )
{
p_aout->output.output.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
}
else if( val.i_int == AOUT_VAR_2F2R ) else if( val.i_int == AOUT_VAR_2F2R )
{ {
p_aout->output.output.i_physical_channels p_aout->output.output.i_physical_channels
...@@ -395,6 +401,24 @@ static void Probe( aout_instance_t * p_aout ) ...@@ -395,6 +401,24 @@ static void Probe( aout_instance_t * p_aout )
} }
} }
/* Test for 3 Front 2 Rear support */
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
AOUT_CHAN_CENTER | AOUT_CHAN_REARLEFT |
AOUT_CHAN_REARRIGHT;
if( p_aout->output.output.i_physical_channels == i_physical_channels )
{
if( CreateDSBufferPCM( p_aout, &i_format, i_physical_channels, 5,
p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS )
{
val.i_int = AOUT_VAR_3F2R;
text.psz_string = N_("3 Front 2 Rear");
var_Change( p_aout, "audio-device",
VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 5 channels" );
}
}
/* Test for 2 Front 2 Rear support */ /* Test for 2 Front 2 Rear support */
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT; AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
...@@ -422,6 +446,7 @@ static void Probe( aout_instance_t * p_aout ) ...@@ -422,6 +446,7 @@ static void Probe( aout_instance_t * p_aout )
val.i_int = AOUT_VAR_STEREO; val.i_int = AOUT_VAR_STEREO;
text.psz_string = N_("Stereo"); text.psz_string = N_("Stereo");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text );
var_Change( p_aout, "audio-device", VLC_VAR_SETDEFAULT, &val, NULL );
msg_Dbg( p_aout, "device supports 2 channels" ); msg_Dbg( p_aout, "device supports 2 channels" );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ntservice.c: Windows NT/2K/XP service interface * ntservice.c: Windows NT/2K/XP service interface
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: ntservice.c,v 1.1 2003/08/13 23:26:55 gbazin Exp $ * $Id: ntservice.c,v 1.2 2003/08/14 11:47:32 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -45,6 +45,12 @@ static void Close ( vlc_object_t * ); ...@@ -45,6 +45,12 @@ static void Close ( vlc_object_t * );
#define NAME_TEXT N_( "Display name of the service" ) #define NAME_TEXT N_( "Display name of the service" )
#define NAME_LONGTEXT N_( \ #define NAME_LONGTEXT N_( \
"This allows you to change the display name of the service." ) "This allows you to change the display name of the service." )
#define EXTRAINTF_TEXT N_("Extra interface modules")
#define EXTRAINTF_LONGTEXT N_( \
"This option allows you to select additional interfaces spawned by the " \
"service. It should be specified at install time so the service is " \
"properly configured. Use a comma separated list of interface modules. " \
"(common values are: logger,sap,rc,http)")
vlc_module_begin(); vlc_module_begin();
set_description( _("Windows NT/2K/XP service interface") ); set_description( _("Windows NT/2K/XP service interface") );
...@@ -52,6 +58,7 @@ vlc_module_begin(); ...@@ -52,6 +58,7 @@ vlc_module_begin();
add_bool( "ntservice-install", 0, NULL, INSTALL_TEXT, INSTALL_LONGTEXT, VLC_TRUE ); add_bool( "ntservice-install", 0, NULL, INSTALL_TEXT, INSTALL_LONGTEXT, VLC_TRUE );
add_bool( "ntservice-uninstall", 0, NULL, INSTALL_TEXT, INSTALL_LONGTEXT, VLC_TRUE ); add_bool( "ntservice-uninstall", 0, NULL, INSTALL_TEXT, INSTALL_LONGTEXT, VLC_TRUE );
add_string ( "ntservice-name", VLCSERVICENAME, NULL, NAME_TEXT, NAME_LONGTEXT, VLC_TRUE ); add_string ( "ntservice-name", VLCSERVICENAME, NULL, NAME_TEXT, NAME_LONGTEXT, VLC_TRUE );
add_string ( "ntservice-extraintf", NULL, NULL, EXTRAINTF_TEXT, EXTRAINTF_LONGTEXT, VLC_TRUE );
set_capability( "interface", 0 ); set_capability( "interface", 0 );
set_callbacks( Activate, Close ); set_callbacks( Activate, Close );
...@@ -143,7 +150,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -143,7 +150,7 @@ static void Run( intf_thread_t *p_intf )
static int NTServiceInstall( intf_thread_t *p_intf ) static int NTServiceInstall( intf_thread_t *p_intf )
{ {
intf_sys_t *p_sys = p_intf->p_sys; intf_sys_t *p_sys = p_intf->p_sys;
char psz_path[MAX_PATH], psz_pathtmp[MAX_PATH]; char psz_path[MAX_PATH], psz_pathtmp[MAX_PATH], *psz_extraintf;
SC_HANDLE handle = OpenSCManager( NULL, NULL, SC_MANAGER_ALL_ACCESS ); SC_HANDLE handle = OpenSCManager( NULL, NULL, SC_MANAGER_ALL_ACCESS );
if( handle == NULL ) if( handle == NULL )
{ {
...@@ -156,6 +163,14 @@ static int NTServiceInstall( intf_thread_t *p_intf ) ...@@ -156,6 +163,14 @@ static int NTServiceInstall( intf_thread_t *p_intf )
GetModuleFileName( NULL, psz_pathtmp, MAX_PATH ); GetModuleFileName( NULL, psz_pathtmp, MAX_PATH );
sprintf( psz_path, "\"%s\" -I "MODULE_STRING, psz_pathtmp ); sprintf( psz_path, "\"%s\" -I "MODULE_STRING, psz_pathtmp );
psz_extraintf = config_GetPsz( p_intf, "ntservice-extraintf" );
if( psz_extraintf && *psz_extraintf )
{
strcat( psz_path, " --ntservice-extraintf " );
strcat( psz_path, psz_extraintf );
}
if( psz_extraintf ) free( psz_extraintf );
SC_HANDLE service = SC_HANDLE service =
CreateService( handle, p_sys->psz_service, p_sys->psz_service, CreateService( handle, p_sys->psz_service, p_sys->psz_service,
GENERIC_READ | GENERIC_EXECUTE, GENERIC_READ | GENERIC_EXECUTE,
...@@ -166,13 +181,15 @@ static int NTServiceInstall( intf_thread_t *p_intf ) ...@@ -166,13 +181,15 @@ static int NTServiceInstall( intf_thread_t *p_intf )
{ {
if( GetLastError() != ERROR_SERVICE_EXISTS ) if( GetLastError() != ERROR_SERVICE_EXISTS )
{ {
msg_Err( p_intf, "Could not create new service" ); msg_Err( p_intf, "Could not create new service: \"%s\" (%s)",
p_sys->psz_service ,psz_path );
CloseServiceHandle( handle ); CloseServiceHandle( handle );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
else else
{ {
msg_Warn( p_intf, "Service already exists" ); msg_Warn( p_intf, "Service \"%s\" already exists",
p_sys->psz_service );
} }
} }
else else
...@@ -209,7 +226,8 @@ static int NTServiceUninstall( intf_thread_t *p_intf ) ...@@ -209,7 +226,8 @@ static int NTServiceUninstall( intf_thread_t *p_intf )
/* Remove the service */ /* Remove the service */
if( !DeleteService( service ) ) if( !DeleteService( service ) )
{ {
msg_Err( p_intf, "Could not delete service" ); msg_Err( p_intf, "Could not delete service \"%s\"",
p_sys->psz_service );
} }
else else
{ {
...@@ -226,6 +244,7 @@ static void WINAPI ServiceDispatch( DWORD numArgs, char **args ) ...@@ -226,6 +244,7 @@ static void WINAPI ServiceDispatch( DWORD numArgs, char **args )
{ {
intf_thread_t *p_intf = (intf_thread_t *)p_global_intf; intf_thread_t *p_intf = (intf_thread_t *)p_global_intf;
intf_sys_t *p_sys = p_intf->p_sys; intf_sys_t *p_sys = p_intf->p_sys;
char *psz_modules, *psz_parser;
/* We have to initialize the service-specific stuff */ /* We have to initialize the service-specific stuff */
memset( &p_sys->status, 0, sizeof(SERVICE_STATUS) ); memset( &p_sys->status, 0, sizeof(SERVICE_STATUS) );
...@@ -241,6 +260,54 @@ static void WINAPI ServiceDispatch( DWORD numArgs, char **args ) ...@@ -241,6 +260,54 @@ static void WINAPI ServiceDispatch( DWORD numArgs, char **args )
return; return;
} }
/*
* Load background interfaces
*/
psz_modules = config_GetPsz( p_intf, "ntservice-extraintf" );
psz_parser = psz_modules;
while( psz_parser && *psz_parser )
{
char *psz_module, *psz_temp;
psz_module = psz_parser;
psz_parser = strchr( psz_module, ',' );
if( psz_parser )
{
*psz_parser = '\0';
psz_parser++;
}
psz_temp = (char *)malloc( strlen(psz_module) + sizeof(",none") );
if( psz_temp )
{
intf_thread_t *p_new_intf;
sprintf( psz_temp, "%s,none", psz_module );
/* Try to create the interface */
p_new_intf = intf_Create( p_intf, psz_temp );
if( p_new_intf == NULL )
{
msg_Err( p_intf, "interface \"%s\" initialization failed",
psz_temp );
free( psz_temp );
continue;
}
/* Try to run the interface */
p_new_intf->b_block = VLC_FALSE;
if( intf_RunThread( p_new_intf ) )
{
vlc_object_detach( p_new_intf );
intf_Destroy( p_new_intf );
msg_Err( p_intf, "interface \"%s\" cannot run", psz_temp );
}
free( psz_temp );
}
}
if( psz_modules )
{
free( psz_modules );
}
/* Initialization complete - report running status */ /* Initialization complete - report running status */
p_sys->status.dwCurrentState = SERVICE_RUNNING; p_sys->status.dwCurrentState = SERVICE_RUNNING;
p_sys->status.dwCheckPoint = 0; p_sys->status.dwCheckPoint = 0;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ts.c: MPEG-II TS Muxer * ts.c: MPEG-II TS Muxer
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: ts.c,v 1.26 2003/08/10 14:23:15 gbazin Exp $ * $Id: ts.c,v 1.27 2003/08/14 11:47:32 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org> * Eric Petit <titer@videolan.org>
...@@ -218,28 +218,6 @@ static void TSSetDate( sout_buffer_chain_t *, mtime_t, mtime_t ); ...@@ -218,28 +218,6 @@ static void TSSetDate( sout_buffer_chain_t *, mtime_t, mtime_t );
static void TSSetConstraints( sout_mux_t*, sout_buffer_chain_t *, static void TSSetConstraints( sout_mux_t*, sout_buffer_chain_t *,
mtime_t i_length, int i_bitrate_min, int i_bitrate_max ); mtime_t i_length, int i_bitrate_min, int i_bitrate_max );
#if !defined( HAVE_ATOLL )
/* Et oui y'a des systemes de MERDE (ex: OS X, Solaris) qui ne l'ont pas :((( */
static long long atoll(const char *str)
{
long long i_value = 0;
int sign = 1;
if( *str == '-' )
{
sign = -1;
}
while( *str >= '0' && *str <= '9' )
{
i_value = i_value * 10 + ( *str - '0' );
}
return i_value * sign;
}
#endif
/***************************************************************************** /*****************************************************************************
* Open: * Open:
*****************************************************************************/ *****************************************************************************/
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libc.c: Extra libc function for some systems. * libc.c: Extra libc function for some systems.
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: libc.c,v 1.8 2003/05/27 01:48:50 hartman Exp $ * $Id: libc.c,v 1.9 2003/08/14 11:47:31 gbazin Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -146,6 +146,29 @@ double vlc_atof( const char *nptr ) ...@@ -146,6 +146,29 @@ double vlc_atof( const char *nptr )
} }
#endif #endif
/*****************************************************************************
* atoll: convert a string to a 64 bits int.
*****************************************************************************/
#if !defined( HAVE_ATOLL )
int64_t vlc_atoll( const char *str )
{
int64_t i_value = 0;
int sign = 1;
if( *str == '-' )
{
sign = -1;
}
while( *str >= '0' && *str <= '9' )
{
i_value = i_value * 10 + ( *str - '0' );
}
return i_value * sign;
}
#endif
/***************************************************************************** /*****************************************************************************
* lseek: reposition read/write file offset. * lseek: reposition read/write file offset.
***************************************************************************** *****************************************************************************
......
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