[vlc-devel] [PATCH] [PATCH] Shortcut for multiple video tracks.

Andrei Ciurea andrei.ciurea96 at gmail.com
Mon Feb 27 03:06:34 CET 2017


---
 modules/control/hotkeys.c | 60 ++++++++++++++++-------------------------------
 1 file changed, 20 insertions(+), 40 deletions(-)

diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 2c25d0c..d1b5727 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -700,17 +700,26 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
             }
             break;
         }
-
+        case ACTIONID_VIDEO_TRACK:
         case ACTIONID_AUDIO_TRACK:
-            if( p_input )
+          if( p_input )
             {
                 vlc_value_t val, list, list2;
                 int i_count, i;
+
+                if(i_action == ACTIONID_VIDEO_TRACK){
+                var_Get( p_input, "video-es", &val );
+                var_Change( p_input, "video-es", VLC_VAR_GETCHOICES,
+                            &list, &list2 );
+
+                }
+                else{
                 var_Get( p_input, "audio-es", &val );
                 var_Change( p_input, "audio-es", VLC_VAR_GETCHOICES,
                             &list, &list2 );
+            }
                 i_count = list.p_list->i_count;
-                if( i_count > 1 )
+                if( (i_count = list.p_list->i_count) > 1 )
                 {
                     for( i = 0; i < i_count; i++ )
                     {
@@ -719,7 +728,7 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
                             break;
                         }
                     }
-                    /* value of audio-es was not in choices list */
+                    /* value of audio-es / video-es was not in choices list */
                     if( i == i_count )
                     {
                         msg_Warn( p_input,
@@ -730,49 +739,20 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
                         i = 1;
                     else
                         i++;
+                    if(i_action == ACTIONID_VIDEO_TRACK){
+                         var_Set( p_input, "video-es", list.p_list->p_values[i] );
+                    DisplayMessage( p_vout, _("Video track: %s"),
+                                    list2.p_list->p_values[i].psz_string );
+                    }
+                    else{
                     var_Set( p_input, "audio-es", list.p_list->p_values[i] );
                     DisplayMessage( p_vout, _("Audio track: %s"),
                                     list2.p_list->p_values[i].psz_string );
                 }
-                var_FreeList( &list, &list2 );
-            }
-            break;  
-        case ACTIONID_VIDEO_TRACK:
-         if( p_input )
-            {
-                vlc_value_t val, list, list2;
-                int i_count, i;
-                var_Get( p_input, "video-es", &val );
-                var_Change( p_input, "video-es", VLC_VAR_GETCHOICES,
-                            &list, &list2 );
-                
-                if( (i_count = list.p_list->i_count) > 1 )
-                {
-                    for( i = 0; i < i_count; i++ )
-                    {
-                        if( val.i_int == list.p_list->p_values[i].i_int )
-                        {
-                            break;
-                        }
-                    }
-                    /* value of video-es was not in choices list */
-                    if( i == i_count )
-                    {
-                        msg_Warn( p_input,
-                                  "invalid current video track, selecting 0" );
-                        i = 0;
-                    }
-                    else if( i == i_count - 1 )
-                        i = 1;
-                    else
-                        i++;
-                    var_Set( p_input, "video-es", list.p_list->p_values[i] );
-                    DisplayMessage( p_vout, _("Video track: %s"),
-                                    list2.p_list->p_values[i].psz_string );
                 }
                 var_FreeList( &list, &list2 );
             }
-            break;
+            break;  
         case ACTIONID_SUBTITLE_TRACK:
             if( p_input )
             {
-- 
2.10.2



More information about the vlc-devel mailing list