]> git.sesse.net Git - vlc/commitdiff
* src/extras/libc.c, nclude/vlc_common.h, modules/mux/mpeg/ts.c: added atoll() to...
authorGildas Bazin <gbazin@videolan.org>
Thu, 14 Aug 2003 11:47:32 +0000 (11:47 +0000)
committerGildas Bazin <gbazin@videolan.org>
Thu, 14 Aug 2003 11:47:32 +0000 (11:47 +0000)
* 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).

include/audio_output.h
include/vlc_common.h
modules/audio_output/directx.c
modules/control/ntservice.c
modules/mux/mpeg/ts.c
src/extras/libc.c

index a64041f8cab505f90f85c242c549ef9e6af78900..eaab48c8c51f1d1da05a0b1cb8b0c444d80f5185 100644 (file)
@@ -2,7 +2,7 @@
  * audio_output.h : audio output interface
  *****************************************************************************
  * 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>
  *
@@ -125,11 +125,12 @@ typedef int32_t vlc_fixed_t;
 /* Values used for the audio-device and audio-channels object variables */
 #define AOUT_VAR_MONO               1
 #define AOUT_VAR_STEREO             2
-#define AOUT_VAR_2F2R               3
-#define AOUT_VAR_5_1                4
-#define AOUT_VAR_6_1                5
-#define AOUT_VAR_7_1                6
-#define AOUT_VAR_SPDIF              7
+#define AOUT_VAR_2F2R               4
+#define AOUT_VAR_3F2R               5
+#define AOUT_VAR_5_1                6
+#define AOUT_VAR_6_1                7
+#define AOUT_VAR_7_1                8
+#define AOUT_VAR_SPDIF              10
 
 #define AOUT_VAR_CHAN_STEREO        1
 #define AOUT_VAR_CHAN_RSTEREO       2
index 608831395832a41fcbc35c2ae7e8a0f00b1eb822..c94640b4987de251a02ba77c41dd06045950ad8d 100644 (file)
@@ -3,7 +3,7 @@
  * Collection of useful common types and macros definitions
  *****************************************************************************
  * 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>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -543,6 +543,13 @@ static inline uint64_t U64_AT( void * _p )
 #   define vlc_atof NULL
 #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
 #   define getenv vlc_getenv
     VLC_EXPORT( char *, vlc_getenv, ( const char *name ) );
index ed7c407e65d8b4b308d95b528b6ce93059d99100..6ec11a96f9f8c20609cd3f96071de9a6d36f53b6 100644 (file)
@@ -2,7 +2,7 @@
  * directx.c: Windows DirectX audio output method
  *****************************************************************************
  * 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>
  *
@@ -307,6 +307,12 @@ static int OpenAudio( vlc_object_t *p_this )
                    | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT
                    | 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 )
         {
             p_aout->output.output.i_physical_channels
@@ -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 */
     i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
                           AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
@@ -422,6 +446,7 @@ static void Probe( aout_instance_t * p_aout )
         val.i_int = AOUT_VAR_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_SETDEFAULT, &val, NULL );
         msg_Dbg( p_aout, "device supports 2 channels" );
     }
 
index 0b1b130ab978886bc7db3a43a2da2b9168edd6b5..582d31afd5e91edc6a5064620d436b647e40b1b4 100755 (executable)
@@ -2,7 +2,7 @@
  * ntservice.c: Windows NT/2K/XP service interface
  *****************************************************************************
  * 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>
  *
@@ -45,6 +45,12 @@ static void Close   ( vlc_object_t * );
 #define NAME_TEXT N_( "Display name of the service" )
 #define NAME_LONGTEXT N_( \
     "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();
     set_description( _("Windows NT/2K/XP service interface") );
@@ -52,6 +58,7 @@ vlc_module_begin();
     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_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_callbacks( Activate, Close );
@@ -143,7 +150,7 @@ static void Run( intf_thread_t *p_intf )
 static int NTServiceInstall( intf_thread_t *p_intf )
 {
     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 );
     if( handle == NULL )
     {
@@ -156,6 +163,14 @@ static int NTServiceInstall( intf_thread_t *p_intf )
     GetModuleFileName( NULL, psz_pathtmp, MAX_PATH );
     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 =
         CreateService( handle, p_sys->psz_service, p_sys->psz_service,
                        GENERIC_READ | GENERIC_EXECUTE,
@@ -166,13 +181,15 @@ static int NTServiceInstall( intf_thread_t *p_intf )
     {
         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 );
             return VLC_EGENERIC;
         }
         else
         {
-            msg_Warn( p_intf, "Service already exists" );
+            msg_Warn( p_intf, "Service \"%s\" already exists",
+                      p_sys->psz_service );
         }
     }
     else
@@ -209,7 +226,8 @@ static int NTServiceUninstall( intf_thread_t *p_intf )
     /* Remove the 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
     {
@@ -226,6 +244,7 @@ static void WINAPI ServiceDispatch( DWORD numArgs, char **args )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_global_intf;
     intf_sys_t    *p_sys  = p_intf->p_sys;
+    char *psz_modules, *psz_parser;
 
     /* We have to initialize the service-specific stuff */
     memset( &p_sys->status, 0, sizeof(SERVICE_STATUS) );
@@ -241,6 +260,54 @@ static void WINAPI ServiceDispatch( DWORD numArgs, char **args )
         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 */
     p_sys->status.dwCurrentState = SERVICE_RUNNING; 
     p_sys->status.dwCheckPoint   = 0; 
index 8e5a714bb99bd9aaebabc07ccb66664f1971ba67..d6756d4c0d775dca59b758505e972c122625b449 100644 (file)
@@ -2,7 +2,7 @@
  * ts.c: MPEG-II TS Muxer
  *****************************************************************************
  * 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>
  *          Eric Petit <titer@videolan.org>
@@ -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 *,
                               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:
  *****************************************************************************/
index 37c664dd4171e7de268dcb4b6298f1ef471b0ec1..58dfd1416574ef557c560143b30c804afe8d94bc 100644 (file)
@@ -2,7 +2,7 @@
  * libc.c: Extra libc function for some systems.
  *****************************************************************************
  * 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>
  *          Samuel Hocevar <sam@zoy.org>
@@ -146,6 +146,29 @@ double vlc_atof( const char *nptr )
 }
 #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.
  *****************************************************************************