[vlc-devel] [PATCH] Correct logic errors in rc interface - this time with playlist release.

Ken Self kenself at optusnet.com.au
Fri Jan 16 08:28:03 CET 2009


---
 modules/control/rc.c |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/modules/control/rc.c b/modules/control/rc.c
index ad2b89c..2055f38 100644
--- a/modules/control/rc.c
+++ b/modules/control/rc.c
@@ -1046,18 +1046,22 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
     intf_thread_t *p_intf = (intf_thread_t*)p_this;
     input_thread_t *p_input;
     vlc_value_t     val;
+    playlist_t *p_playlist = pl_Hold( p_this );
 
     p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
     if( !p_input ) return VLC_ENOOBJ;
 
     var_Get( p_input, "state", &val );
-    if( ( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) ) &&
+    if( ( ( val.i_int == PAUSE_S ) ||
+          ( playlist_Status( p_playlist ) == PLAYLIST_PAUSED ) ) &&
         ( strcmp( psz_cmd, "pause" ) != 0 ) )
     {
         msg_rc( _("Press menu select or pause to continue.") );
+        pl_Release( p_this );
         vlc_object_release( p_input );
         return VLC_EGENERIC;
     }
+    pl_Release( p_this );
 
     /* Parse commands that only require an input */
     if( !strcmp( psz_cmd, "pause" ) )
@@ -1328,7 +1332,8 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
         var_Get( p_input, "state", &val );
         vlc_object_release( p_input );
 
-        if( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) )
+        if( ( val.i_int == PAUSE_S ) ||
+            ( playlist_Status( p_playlist ) == PLAYLIST_PAUSED ) )
         {
             msg_rc( _("Type 'menu select' or 'pause' to continue.") );
             pl_Release( p_this );
@@ -1572,6 +1577,7 @@ static int Volume( vlc_object_t *p_this, char const *psz_cmd,
     VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data);
     intf_thread_t *p_intf = (intf_thread_t*)p_this;
     input_thread_t *p_input = NULL;
+    playlist_t *p_playlist = pl_Hold( p_this );
     int i_error = VLC_EGENERIC;
 
     p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
@@ -1583,14 +1589,17 @@ static int Volume( vlc_object_t *p_this, char const *psz_cmd,
         vlc_value_t val;
 
         var_Get( p_input, "state", &val );
-        if( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) )
+        if( ( val.i_int == PAUSE_S ) ||
+            ( playlist_Status( p_playlist ) == PLAYLIST_PAUSED ) )
         {
             msg_rc( _("Type 'menu select' or 'pause' to continue.") );
+            pl_Release( p_this );
             vlc_object_release( p_input );
             return VLC_EGENERIC;
         }
         vlc_object_release( p_input );
     }
+    pl_Release( p_this );
 
     if ( *newval.psz_string )
     {
@@ -1641,6 +1650,7 @@ static int VolumeMove( vlc_object_t *p_this, char const *psz_cmd,
     intf_thread_t *p_intf = (intf_thread_t*)p_this;
     audio_volume_t i_volume;
     input_thread_t *p_input = NULL;
+    playlist_t *p_playlist = pl_Hold( p_this );
     int i_nb_steps = atoi(newval.psz_string);
     int i_error = VLC_SUCCESS;
     int i_volume_step = 0;
@@ -1654,14 +1664,17 @@ static int VolumeMove( vlc_object_t *p_this, char const *psz_cmd,
         vlc_value_t val;
 
         var_Get( p_input, "state", &val );
-        if( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) )
+        if( ( val.i_int == PAUSE_S ) ||
+            ( playlist_Status( p_playlist ) == PLAYLIST_PAUSED ) )
         {
             msg_rc( _("Type 'menu select' or 'pause' to continue.") );
+            pl_Release( p_this );
             vlc_object_release( p_input );
             return VLC_EGENERIC;
         }
         vlc_object_release( p_input );
     }
+    pl_Release( p_this );
 
     i_volume_step = config_GetInt( p_intf->p_libvlc, "volume-step" );
     if ( i_nb_steps <= 0 || i_nb_steps > (AOUT_VOLUME_MAX/i_volume_step) )
@@ -1825,6 +1838,7 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
     VLC_UNUSED(oldval); VLC_UNUSED(p_data);
     intf_thread_t *p_intf = (intf_thread_t*)p_this;
     input_thread_t *p_input = NULL;
+    playlist_t *p_playlist = pl_Hold( p_this );
     aout_instance_t * p_aout;
     const char * psz_variable;
     vlc_value_t val_name;
@@ -1839,13 +1853,17 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
         vlc_value_t val;
 
         var_Get( p_input, "state", &val );
-        if( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) )        {
+        if( ( val.i_int == PAUSE_S ) ||
+            ( playlist_Status( p_playlist ) == PLAYLIST_PAUSED ) )
+        {
             msg_rc( _("Type 'menu select' or 'pause' to continue.") );
+            pl_Release( p_this );
             vlc_object_release( p_input );
             return VLC_EGENERIC;
         }
         vlc_object_release( p_input );
     }
+    pl_Release( p_this );
 
     p_aout = vlc_object_find( p_this, VLC_OBJECT_AOUT, FIND_ANYWHERE );
     if ( p_aout == NULL ) return VLC_ENOOBJ;
@@ -1938,7 +1956,8 @@ static int Menu( vlc_object_t *p_this, char const *psz_cmd,
         var_Get( p_input, "state", &val );
         vlc_object_release( p_input );
 
-        if( ( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) ) &&
+        if( ( ( val.i_int == PAUSE_S ) ||
+              ( playlist_Status( p_playlist ) == PLAYLIST_PAUSED ) ) &&
             ( strcmp( newval.psz_string, "select" ) != 0 ) )
         {
             msg_rc( _("Type 'menu select' or 'pause' to continue.") );
-- 
1.5.4.3




More information about the vlc-devel mailing list