]> git.sesse.net Git - vlc/blobdiff - modules/control/rc.c
The last but not the least commit about these useless tests.
[vlc] / modules / control / rc.c
index 409606de5a9edf3a0abdbf9cf6d5c439e0e4119b..e771248ddc2d9235d5c8858cef1b2b5c2441c381 100644 (file)
@@ -126,7 +126,6 @@ struct intf_sys_t
     /* status changes */
     vlc_mutex_t       status_lock;
     playlist_status_t i_last_state;
-    vlc_bool_t        b_statistics;
 
 #ifdef WIN32
     HANDLE hConsoleIn;
@@ -324,7 +323,6 @@ static int Activate( vlc_object_t *p_this )
     p_intf->p_sys->psz_unix_path = psz_unix_path;
     vlc_mutex_init( p_intf, &p_intf->p_sys->status_lock );
     p_intf->p_sys->i_last_state = PLAYLIST_STOPPED;
-    p_intf->p_sys->b_statistics = VLC_FALSE;
 
     /* Non-buffered stdout */
     setvbuf( stdout, (char *)NULL, _IOLBF, 0 );
@@ -583,13 +581,6 @@ static void Run( intf_thread_t *p_intf )
             }
         }
 
-        if( p_input && p_intf->p_sys->b_statistics )
-        {
-            vlc_mutex_lock( &input_GetItem(p_input)->lock );
-            updateStatistics( p_intf, input_GetItem(p_input) );
-            vlc_mutex_unlock( &input_GetItem(p_input)->lock );
-        }
-
         /* Is there something to do? */
         if( !b_complete ) continue;
 
@@ -1279,7 +1270,7 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
                         &val, &text );
             msg_rc( "+----[ end of %s ]", val_name.psz_string );
 
-            if( val_name.psz_string ) free( val_name.psz_string );
+            free( val_name.psz_string );
 
             i_error = VLC_SUCCESS;
         }
@@ -1432,9 +1423,12 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
         if( p_item )
         {
             msg_rc( "Trying to add %s to playlist.", newval.psz_string );
-            playlist_AddInput( p_playlist, p_item,
+            if( playlist_AddInput( p_playlist, p_item,
                      PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE,
-                     VLC_FALSE );
+                     VLC_FALSE ) != VLC_SUCCESS );
+            {
+                return VLC_EGENERIC;
+            }
         }
     }
     else if( !strcmp( psz_cmd, "enqueue" ) &&
@@ -1445,9 +1439,12 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
         if( p_item )
         {
             msg_rc( "trying to enqueue %s to playlist", newval.psz_string );
-            playlist_AddInput( p_playlist, p_item,
+            if( playlist_AddInput( p_playlist, p_item,
                                PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE,
-                               VLC_FALSE);
+                               VLC_FALSE ) != VLC_SUCCESS )
+            {
+                return VLC_EGENERIC;
+            }
         }
     }
     else if( !strcmp( psz_cmd, "playlist" ) )
@@ -1474,7 +1471,7 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
             msg_rc( STATUS_CHANGE "( audio volume: %d )",
                     config_GetInt( p_intf, "volume" ));
 
-            vlc_mutex_lock( &p_playlist->object_lock );
+            PL_LOCK;
             switch( p_playlist->status.i_status )
             {
                 case PLAYLIST_STOPPED:
@@ -1490,7 +1487,7 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
                     msg_rc( STATUS_CHANGE "( state unknown )" );
                     break;
             }
-            vlc_mutex_unlock( &p_playlist->object_lock );
+            PL_UNLOCK;
         }
     }
 
@@ -1781,7 +1778,7 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd,
                     &val, &text );
         msg_rc( "+----[ end of %s ]", val_name.psz_string );
 
-        if( val_name.psz_string ) free( val_name.psz_string );
+        free( val_name.psz_string );
 
         i_error = VLC_SUCCESS;
     }
@@ -1868,7 +1865,7 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
                     &val, &text );
         msg_rc( "+----[ end of %s ]", val_name.psz_string );
 
-        if( val_name.psz_string ) free( val_name.psz_string );
+        free( val_name.psz_string );
         i_error = VLC_SUCCESS;
     }
     else
@@ -1936,12 +1933,12 @@ static int Menu( vlc_object_t *p_this, char const *psz_cmd,
     {
         msg_rc( _("Please provide one of the following parameters:") );
         msg_rc( "[on|off|up|down|left|right|select]" );
-        if( val.psz_string ) free( val.psz_string );
-            return i_error;
+        free( val.psz_string );
+        return i_error;
     }
 
     i_error = VLC_SUCCESS;
-    if( val.psz_string ) free( val.psz_string );
+    free( val.psz_string );
     return i_error;
 }
 
@@ -1959,11 +1956,9 @@ static int Statistics ( vlc_object_t *p_this, char const *psz_cmd,
 
     if( !strcmp( psz_cmd, "stats" ) )
     {
-        p_intf->p_sys->b_statistics = !p_intf->p_sys->b_statistics;
-        if( p_intf->p_sys->b_statistics )
-            msg_rc(_("statistics update on"));
-        else
-            msg_rc(_("statistics update off"));
+        vlc_mutex_lock( &input_GetItem(p_input)->lock );
+        updateStatistics( p_intf, input_GetItem(p_input) );
+        vlc_mutex_unlock( &input_GetItem(p_input)->lock );
     }
     /*
      * sanity check