[vlc-commits] input: fix changing state

Rémi Denis-Courmont git at videolan.org
Mon Mar 30 17:00:32 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Mar 30 17:57:42 2015 +0300| [c6d907cf404ce7d6699f9e30a551ec9a0fa4985b] | committer: Rémi Denis-Courmont

input: fix changing state

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

 src/input/input.c |   37 +++++++++++++++++--------------------
 1 file changed, 17 insertions(+), 20 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index f1d9e8f..8c54746 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1731,27 +1731,24 @@ static bool Control( input_thread_t *p_input,
         }
 
         case INPUT_CONTROL_SET_STATE:
-            if( val.i_int != PLAYING_S && val.i_int != PAUSE_S )
-                msg_Err( p_input, "invalid state in INPUT_CONTROL_SET_STATE" );
-            else if( p_input->p->i_state == PAUSE_S )
+            switch( val.i_int )
             {
-                ControlUnpause( p_input, i_control_date );
-
-                b_force_update = true;
-            }
-            else if( val.i_int == PAUSE_S && p_input->p->i_state == PLAYING_S /* &&
-                     p_input->p->b_can_pause */ )
-            {
-                ControlPause( p_input, i_control_date );
-
-                b_force_update = true;
-            }
-            else if( val.i_int == PAUSE_S && !p_input->p->b_can_pause && 0 )
-            {
-                b_force_update = true;
-
-                /* Correct "state" value */
-                input_ChangeState( p_input, p_input->p->i_state );
+                case PLAYING_S:
+                    if( p_input->p->i_state == PAUSE_S )
+                    {
+                        ControlUnpause( p_input, i_control_date );
+                        b_force_update = true;
+                    }
+                    break;
+                case PAUSE_S:
+                    if( p_input->p->i_state == PLAYING_S )
+                    {
+                        ControlPause( p_input, i_control_date );
+                        b_force_update = true;
+                    }
+                    break;
+                default:
+                    msg_Err( p_input, "invalid INPUT_CONTROL_SET_STATE" );
             }
             break;
 



More information about the vlc-commits mailing list