[vlc-devel] commit: Sanitize STATUS_CHANGE messages. (Jean-Paul Saman )

git version control git at videolan.org
Fri Apr 11 13:21:45 CEST 2008


vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Fri Apr 11 10:41:09 2008 +0200| [821a5903564db0029de97e113bcc67a46cc4c050]

Sanitize STATUS_CHANGE messages.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=821a5903564db0029de97e113bcc67a46cc4c050
---

 include/vlc_input.h  |    2 ++
 modules/control/rc.c |   22 +++++++++++++---------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 5e03e91..994d828 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -544,6 +544,8 @@ enum input_state_e
     ERROR_S
 };
 
+static const char *ppsz_input_state[] = { N_("Initializing"), N_("Opening"), N_("Buffer"), N_("Play"), N_("Pause"), N_("Stop"), N_("Error") }
+
 /* "rate" default, min/max
  * A rate below 1000 plays the movie faster,
  * A rate above 1000 plays the movie slower.
diff --git a/modules/control/rc.c b/modules/control/rc.c
index 7f54776..8bf1f02 100644
--- a/modules/control/rc.c
+++ b/modules/control/rc.c
@@ -548,21 +548,21 @@ static void Run( intf_thread_t *p_intf )
                 (p_playlist->status.i_status == PLAYLIST_STOPPED) )
             {
                 p_intf->p_sys->i_last_state = PLAYLIST_STOPPED;
-                msg_rc( STATUS_CHANGE "( stop state: 0 )" );
+                msg_rc( STATUS_CHANGE "( stop state: 5 )" );
             }
             else if(
                 (p_intf->p_sys->i_last_state != p_playlist->status.i_status) &&
                 (p_playlist->status.i_status == PLAYLIST_RUNNING) )
             {
                 p_intf->p_sys->i_last_state = p_playlist->status.i_status;
-                msg_rc( STATUS_CHANGE "( play state: 1 )" );
+                 msg_rc( STATUS_CHANGE "( play state: 3 )" );
             }
             else if(
                 (p_intf->p_sys->i_last_state != p_playlist->status.i_status) &&
                 (p_playlist->status.i_status == PLAYLIST_PAUSED) )
             {
                 p_intf->p_sys->i_last_state = p_playlist->status.i_status;
-                msg_rc( STATUS_CHANGE "( pause state: 2 )" );
+                msg_rc( STATUS_CHANGE "( pause state: 4 )" );
             }
             vlc_mutex_unlock( &p_playlist->object_lock );
         }
@@ -999,7 +999,9 @@ static int StateChanged( vlc_object_t *p_this, char const *psz_cmd,
             default:
                 cmd[0] = '\0';
             } /* var_GetInteger( p_input, "state" )  */
-            msg_rc( STATUS_CHANGE "( %s state: %d )", &cmd[0], newval.i_int );
+            msg_rc( STATUS_CHANGE "( %s state: %d ): %s",
+                                  &cmd[0], newval.i_int,
+                                  ppsz_input_state[ newval.i_int ] );
             vlc_object_release( p_playlist );
         }
         vlc_object_release( p_input );
@@ -1479,16 +1481,16 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
             switch( p_playlist->status.i_status )
             {
                 case PLAYLIST_STOPPED:
-                    msg_rc( STATUS_CHANGE "( stop state: 0 )" );
+                    msg_rc( STATUS_CHANGE "( stop state: 5 )" );
                     break;
                 case PLAYLIST_RUNNING:
-                    msg_rc( STATUS_CHANGE "( play state: 1 )" );
+                    msg_rc( STATUS_CHANGE "( play state: 3 )" );
                     break;
                 case PLAYLIST_PAUSED:
-                    msg_rc( STATUS_CHANGE "( pause state: 2 )" );
+                    msg_rc( STATUS_CHANGE "( pause state: 4 )" );
                     break;
                 default:
-                    msg_rc( STATUS_CHANGE "( state unknown )" );
+                    msg_rc( STATUS_CHANGE "( unknown state: -1 )" );
                     break;
             }
             PL_UNLOCK;
@@ -1715,7 +1717,9 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd,
     }
     else  if( !strcmp( psz_cmd, "snapshot" ) )
     {
-        i_error = var_Set( p_vout, psz_variable, newval );
+        vlc_value_t val;
+        val.b_bool = VLC_TRUE;
+        i_error = var_Set( p_vout, psz_variable, val );
     }
     else
     {




More information about the vlc-devel mailing list