]> git.sesse.net Git - vlc/blobdiff - src/libvlc.c
plugin.cpp: don't mess up custom protocol when combining 2 urls
[vlc] / src / libvlc.c
index 85046e2e8dd6d452ee63534060b34db4ac98f3f3..560beef093b27a1c890a73592734b4a106e8ee60 100644 (file)
@@ -275,6 +275,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
     char *       psz_parser;
     char *       psz_control;
     vlc_bool_t   b_exit = VLC_FALSE;
+    int          i_ret = VLC_EEXIT;
     vlc_t *      p_vlc = vlc_current_object( i_object );
     module_t    *p_help_module;
     playlist_t  *p_playlist;
@@ -358,12 +359,14 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
     {
         Help( p_vlc, "help" );
         b_exit = VLC_TRUE;
+        i_ret = VLC_EEXITSUCCESS;
     }
     /* Check for version option */
     else if( config_GetInt( p_vlc, "version" ) )
     {
         Version();
         b_exit = VLC_TRUE;
+        i_ret = VLC_EEXITSUCCESS;
     }
 
     /* Set the config file stuff */
@@ -423,6 +426,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
             /* This is the parent, exit right now */
             msg_Dbg( p_vlc, "closing parent process" );
             b_exit = VLC_TRUE;
+            i_ret = VLC_EEXITSUCCESS;
         }
         else
         {
@@ -444,7 +448,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
         vlc_object_destroy( p_help_module );
         module_EndBank( p_vlc );
         if( i_object ) vlc_object_release( p_vlc );
-        return VLC_EEXIT;
+        return i_ret;
     }
 
     /* Check for translation config option */
@@ -505,18 +509,21 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
         Help( p_vlc, p_tmp );
         free( p_tmp );
         b_exit = VLC_TRUE;
+        i_ret = VLC_EEXITSUCCESS;
     }
     /* Check for long help option */
     else if( config_GetInt( p_vlc, "longhelp" ) )
     {
         Help( p_vlc, "longhelp" );
         b_exit = VLC_TRUE;
+        i_ret = VLC_EEXITSUCCESS;
     }
     /* Check for module list option */
     else if( config_GetInt( p_vlc, "list" ) )
     {
         ListModules( p_vlc );
         b_exit = VLC_TRUE;
+        i_ret = VLC_EEXITSUCCESS;
     }
 
     /* Check for config file options */
@@ -547,7 +554,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
         vlc_object_destroy( p_help_module );
         module_EndBank( p_vlc );
         if( i_object ) vlc_object_release( p_vlc );
-        return VLC_EEXIT;
+        return i_ret;
     }
 
     /*
@@ -778,8 +785,9 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
     var_Create( p_vlc, "drawableh", VLC_VAR_INTEGER );
     var_Create( p_vlc, "drawableportx", VLC_VAR_INTEGER );
     var_Create( p_vlc, "drawableporty", VLC_VAR_INTEGER );
-    var_Create( p_vlc, "width", VLC_VAR_INTEGER );
-    var_Create( p_vlc, "height", VLC_VAR_INTEGER );
+
+    /* Create volume callback system. */
+    var_Create( p_vlc, "volume-change", VLC_VAR_BOOL );
 
     /*
      * Get input filenames given as commandline arguments
@@ -1218,7 +1226,7 @@ int VLC_AddTarget( int i_object, char const *psz_target,
 }
 
 /*****************************************************************************
- * VLC_Play: play
+ * VLC_Play: play the playlist
  *****************************************************************************/
 int VLC_Play( int i_object )
 {
@@ -1311,7 +1319,6 @@ vlc_bool_t VLC_IsPlaying( int i_object )
 {
     playlist_t * p_playlist;
     vlc_bool_t   b_playing;
-    vlc_value_t  val;
 
     vlc_t *p_vlc = vlc_current_object( i_object );
 
@@ -1328,13 +1335,18 @@ vlc_bool_t VLC_IsPlaying( int i_object )
         if( i_object ) vlc_object_release( p_vlc );
         return VLC_ENOOBJ;
     }
-    if( !p_playlist->p_input )
+
+    if( p_playlist->p_input )
     {
-        if( i_object ) vlc_object_release( p_vlc );
-        return VLC_ENOOBJ;
+        vlc_value_t  val;
+        var_Get( p_playlist->p_input, "state", &val );
+        b_playing = ( val.i_int == PLAYING_S );
+    }
+    else
+    {
+        msg_Dbg(p_vlc, "polling playlist_IsPlaying");
+        b_playing = playlist_IsPlaying( p_playlist );
     }
-    var_Get( p_playlist->p_input, "state", &val );
-    b_playing = ( val.i_int == PLAYING_S );
     vlc_object_release( p_playlist );
 
     if( i_object ) vlc_object_release( p_vlc );
@@ -1992,7 +2004,7 @@ static void SetLanguage ( char const *psz_lang )
 #endif
     if( !bindtextdomain( PACKAGE_NAME, psz_path ) )
     {
-        fprintf( stderr, "warning: no domain %s in directory %s\n",
+        fprintf( stderr, "warning: couldn't bind domain %s in directory %s\n",
                  PACKAGE_NAME, psz_path );
     }
 
@@ -2447,6 +2459,9 @@ static void ShowConsole( void )
 
     AllocConsole();
 
+    freopen( "CONOUT$", "w", stderr );
+    freopen( "CONIN$", "r", stdin );
+
     if( (f_help = fopen( "vlc-help.txt", "wt" )) )
     {
         fclose( f_help );
@@ -2456,9 +2471,6 @@ static void ShowConsole( void )
 
     else freopen( "CONOUT$", "w", stdout );
 
-    freopen( "CONOUT$", "w", stderr );
-    freopen( "CONIN$", "r", stdin );
-
 #   endif
 }
 #endif
@@ -2549,23 +2561,41 @@ static void InitDeviceValues( vlc_t *p_vlc )
     char *block_dev;
     dbus_bool_t b_dvd;
 
+#ifdef HAVE_HAL_1
+    if( ( ctx = libhal_ctx_init_direct( NULL ) ) )
+#else
     if( ( ctx = hal_initialize( NULL, FALSE ) ) )
+#endif
     {
+#ifdef HAVE_HAL_1
+        if( ( devices = libhal_get_all_devices( ctx, &i_devices, NULL ) ) )
+#else
         if( ( devices = hal_get_all_devices( ctx, &i_devices ) ) )
+#endif
         {
             for( i = 0; i < i_devices; i++ )
             {
+#ifdef HAVE_HAL_1
+                if( !libhal_device_property_exists( ctx, devices[i],
+                                                "storage.cdrom.dvd", NULL ) )
+#else
                 if( !hal_device_property_exists( ctx, devices[ i ],
                                                 "storage.cdrom.dvd" ) )
+#endif
                 {
                     continue;
                 }
-
+#ifdef HAVE_HAL_1
+                b_dvd = libhal_device_get_property_bool( ctx, devices[ i ],
+                                                 "storage.cdrom.dvd", NULL  );
+                block_dev = libhal_device_get_property_string( ctx,
+                                devices[ i ], "block.device" , NULL );
+#else
                 b_dvd = hal_device_get_property_bool( ctx, devices[ i ],
                                                       "storage.cdrom.dvd" );
                 block_dev = hal_device_get_property_string( ctx, devices[ i ],
                                                             "block.device" );
-
+#endif
                 if( b_dvd )
                 {
                     config_PutPsz( p_vlc, "dvd", block_dev );
@@ -2573,13 +2603,24 @@ static void InitDeviceValues( vlc_t *p_vlc )
 
                 config_PutPsz( p_vlc, "vcd", block_dev );
                 config_PutPsz( p_vlc, "cd-audio", block_dev );
-
+#ifdef HAVE_HAL_1
+                libhal_free_string( block_dev );
+#else
                 hal_free_string( block_dev );
+#endif
             }
+#ifdef HAVE_HAL_1
+            libhal_free_string_array( devices );
+#else
             hal_free_string_array( devices );
+#endif
         }
 
+#ifdef HAVE_HAL_1
+        libhal_ctx_shutdown( ctx, NULL );
+#else
         hal_shutdown( ctx );
+#endif
     }
 #endif
 }