[vlc-devel] commit: gestures: ( Rémi Duraffort )

git version control git at videolan.org
Wed May 13 20:07:38 CEST 2009


vlc | branch: 0.9-bugfix | Rémi Duraffort <ivoire at videolan.org> | Wed May 13 19:55:03 2009 +0200| [47ab669d65d57f2e87869f626eea34e1fb7fad1b] | committer: Rémi Duraffort 

gestures:
 * add the possibility to go slower and faster (wasn't finished) (Fix #2741)
 * some cleaning and factorization
Conflicts:

	modules/control/gestures.c

Signed-off-by: Rémi Duraffort <ivoire at videolan.org>
(cherry picked from commit da8ff69a018db3a041860c174ac4c6000af6ae1d)

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

 modules/control/gestures.c |  159 ++++++++++++++++++++++----------------------
 1 files changed, 80 insertions(+), 79 deletions(-)

diff --git a/modules/control/gestures.c b/modules/control/gestures.c
index df9f807..5cdffe4 100644
--- a/modules/control/gestures.c
+++ b/modules/control/gestures.c
@@ -168,6 +168,7 @@ void Close ( vlc_object_t *p_this )
 static void RunIntf( intf_thread_t *p_intf )
 {
     playlist_t * p_playlist = NULL;
+    input_thread_t* p_input;
 
     vlc_mutex_lock( &p_intf->change_lock );
     p_intf->p_sys->p_vout = NULL;
@@ -199,29 +200,63 @@ static void RunIntf( intf_thread_t *p_intf )
             switch( p_intf->p_sys->i_pattern )
             {
             case LEFT:
-                i_interval = config_GetInt( p_intf , "short-jump-size" );
-                if ( i_interval > 0 ) {
-                    val.i_time = ( (mtime_t)( -i_interval ) * 1000000L);
-                    var_Set( p_intf, "time-offset", val );
+                msg_Dbg( p_intf, "Go backward in the movie!" );
+                p_playlist = pl_Yield( p_intf );
+                p_input = playlist_CurrentInput( p_playlist );
+                pl_Release( p_intf );
+                if( p_input )
+                {
+                    i_interval = config_GetInt( p_intf , "short-jump-size" );
+                    if ( i_interval > 0 )
+                    {
+                        val.i_time = ( (mtime_t)( -i_interval ) * 1000000L);
+                        var_Set( p_input, "time-offset", val );
+                    }
+                    vlc_object_release( p_input );
                 }
-                msg_Dbg(p_intf, "Go backward in the movie!");
                 break;
             case RIGHT:
-                i_interval = config_GetInt( p_intf , "short-jump-size" );
-                if ( i_interval > 0 ) {
-                    val.i_time = ( (mtime_t)( i_interval ) * 1000000L);
-                    var_Set( p_intf, "time-offset", val );
+                msg_Dbg( p_intf, "Go forward in the movie!" );
+                p_playlist = pl_Yield( p_intf );
+                p_input = playlist_CurrentInput( p_playlist );
+                pl_Release( p_intf );
+
+                if( p_input )
+                {
+                    i_interval = config_GetInt( p_intf , "short-jump-size" );
+                    if ( i_interval > 0 )
+                    {
+                        val.i_time = ( (mtime_t)( i_interval ) * 1000000L);
+                        var_Set( p_input, "time-offset", val );
+                    }
+                    vlc_object_release( p_input );
                 }
-                msg_Dbg(p_intf, "Go forward in the movie!");
                 break;
+
             case GESTURE(LEFT,UP,NONE,NONE):
-                /*FIXME BF*/
-                msg_Dbg(p_intf, "Going slower.");
+                msg_Dbg( p_intf, "Going slower." );
+                p_playlist = pl_Yield( p_intf );
+                p_input = playlist_CurrentInput( p_playlist );
+                pl_Release( p_intf );
+                if( p_input )
+                {
+                    var_SetVoid( p_input, "rate-slower" );
+                    vlc_object_release( p_input );
+                }
                 break;
+
             case GESTURE(RIGHT,UP,NONE,NONE):
-                /*FIXME FF*/
-                msg_Dbg(p_intf, "Going faster.");
+                msg_Dbg( p_intf, "Going faster." );
+                p_playlist = pl_Yield( p_intf );
+                p_input = playlist_CurrentInput( p_playlist );
+                pl_Release( p_intf );
+                if( p_input )
+                {
+                    var_SetVoid( p_input, "rate-faster" );
+                    vlc_object_release( p_input );
+                }
                 break;
+
             case GESTURE(LEFT,RIGHT,NONE,NONE):
             case GESTURE(RIGHT,LEFT,NONE,NONE):
                 {
@@ -230,62 +265,46 @@ static void RunIntf( intf_thread_t *p_intf )
 
                     p_input = input_from_playlist( p_playlist );
                     vlc_object_release( p_playlist );
- 
+
                     if( !p_input )
                         break;
- 
-                    val.i_int = PLAYING_S;
-                    if( p_input )
-                    {
-                        var_Get( p_input, "state", &val);
-                        if( val.i_int == PAUSE_S )
-                        {
-                            val.i_int = PLAYING_S;
-                        }
-                        else
-                        {
-                            val.i_int = PAUSE_S;
-                        }
-                        var_Set( p_input, "state", val);
-                    }
-                    msg_Dbg(p_intf, "Play/Pause");
+                    var_Get( p_input, "state", &val);
+                    val.i_int = ( val.i_int != PLAYING_S ) ? PLAYING_S : PAUSE_S;
+                    var_Set( p_input, "state", val);
                     vlc_object_release( p_input );
                 }
                 break;
+
             case GESTURE(LEFT,DOWN,NONE,NONE):
                 p_playlist = pl_Yield( p_intf );
 
                 playlist_Prev( p_playlist );
                 vlc_object_release( p_playlist );
                 break;
+
             case GESTURE(RIGHT,DOWN,NONE,NONE):
                 p_playlist = pl_Yield( p_intf );
 
                 playlist_Next( p_playlist );
                 vlc_object_release( p_playlist );
                 break;
+
             case UP:
-                {
-                    audio_volume_t i_newvol;
-                    aout_VolumeUp( p_intf, 1, &i_newvol );
-                    msg_Dbg(p_intf, "Louder");
-                }
+                msg_Dbg(p_intf, "Louder");
+                aout_VolumeUp( p_intf, 1, NULL );
                 break;
+
             case DOWN:
-                {
-                    audio_volume_t i_newvol;
-                    aout_VolumeDown( p_intf, 1, &i_newvol );
-                    msg_Dbg(p_intf, "Quieter");
-                }
+                msg_Dbg(p_intf, "Quieter");
+                aout_VolumeDown( p_intf, 1, NULL );
                 break;
+
             case GESTURE(UP,DOWN,NONE,NONE):
             case GESTURE(DOWN,UP,NONE,NONE):
-                {
-                    audio_volume_t i_newvol = -1;
-                    aout_VolumeMute( p_intf, &i_newvol );
-                    msg_Dbg(p_intf, "Mute sound");
-                }
+                msg_Dbg(p_intf, "Mute sound");
+                aout_VolumeMute( p_intf, NULL );
                 break;
+
             case GESTURE(UP,RIGHT,NONE,NONE):
                 {
                    input_thread_t * p_input;
@@ -313,32 +332,21 @@ static void RunIntf( intf_thread_t *p_intf )
                    for( i = 0; i < i_count; i++ )
                    {
                        if( val.i_int == list.p_list->p_values[i].i_int )
-                       {
                            break;
-                       }
-                   }
-                   /* value of audio-es was not in choices list */
-                   if( i == i_count )
-                   {
-                       msg_Warn( p_input,
-                               "invalid current audio track, selecting 0" );
-                       var_Set( p_input, "audio-es",
-                               list.p_list->p_values[0] );
-                       i = 0;
-                   }
-                   else if( i == i_count - 1 )
-                   {
-                       var_Set( p_input, "audio-es",
-                               list.p_list->p_values[1] );
-                       i = 1;
                    }
-                   else
-                   {
-                       var_Set( p_input, "audio-es",
-                               list.p_list->p_values[i+1] );
-                       i++;
-                   }
-                   vlc_object_release( p_input );
+                    /* value of audio-es was not in choices list */
+                    if( i == i_count )
+                    {
+                        msg_Warn( p_input,
+                                  "invalid current audio track, selecting 0" );
+                        i = 0;
+                    }
+                    else if( i == i_count - 1 )
+                        i = 1;
+                    else
+                        i++;
+                    var_Set( p_input, "audio-es", list.p_list->p_values[i] );
+                    vlc_object_release( p_input );
                 }
                 break;
             case GESTURE(DOWN,RIGHT,NONE,NONE):
@@ -377,20 +385,13 @@ static void RunIntf( intf_thread_t *p_intf )
                     {
                         msg_Warn( p_input,
                                 "invalid current subtitle track, selecting 0" );
-                        var_Set( p_input, "spu-es", list.p_list->p_values[0] );
                         i = 0;
                     }
                     else if( i == i_count - 1 )
-                    {
-                        var_Set( p_input, "spu-es", list.p_list->p_values[0] );
                         i = 0;
-                    }
                     else
-                    {
-                        var_Set( p_input, "spu-es",
-                                list.p_list->p_values[i+1] );
-                        i = i + 1;
-                    }
+                        i++;
+                    var_Set( p_input, "spu-es", list.p_list->p_values[i] );
                     vlc_object_release( p_input );
                 }
                 break;




More information about the vlc-devel mailing list