]> git.sesse.net Git - vlc/blobdiff - modules/control/hotkeys.c
equalizer.c: compile fix for old compilers (thx sam)
[vlc] / modules / control / hotkeys.c
index fa19e6867b220784eec26e9a5d3fb95e94b48239..102314ae1c2efd813a2a9f51a71a73670d281d90 100755 (executable)
@@ -407,6 +407,86 @@ static void Run( intf_thread_t *p_intf )
                 var_Set( p_input, "time-offset", val );
                 DisplayPosition( p_intf, p_vout, p_input );
             }
+            else if( i_action == ACTIONID_AUDIO_TRACK )
+            {
+                vlc_value_t val, list, list2;
+                int i_count, i;
+                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 )
+                {
+                    continue;
+                }
+                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++;
+                }
+                vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN,
+                                 _("Audio track: %s"),
+                                 list2.p_list->p_values[i].psz_string );
+            }
+            else if( i_action == ACTIONID_SUBTITLE_TRACK )
+            {
+                vlc_value_t val, list, list2;
+                int i_count, i;
+                var_Get( p_input, "spu-es", &val );
+                var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
+                            &list, &list2 );
+                i_count = list.p_list->i_count;
+                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 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;
+                }
+                vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN,
+                                 _("Subtitle track: %s"),
+                                 list2.p_list->p_values[i].psz_string );
+            }
             else if( i_action == ACTIONID_NEXT )
             {
                 p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
@@ -639,9 +719,12 @@ static void ClearChannels( intf_thread_t *p_intf, vout_thread_t *p_vout )
 {
     int i;
 
-    vout_ClearOSDChannel( p_vout, DEFAULT_CHAN );
-    for( i = 0; i < CHANNELS_NUMBER; i++ )
+    if( p_vout )
     {
-        vout_ClearOSDChannel( p_vout, p_intf->p_sys->p_channels[ i ] );
+        vout_ClearOSDChannel( p_vout, DEFAULT_CHAN );
+        for( i = 0; i < CHANNELS_NUMBER; i++ )
+        {
+            vout_ClearOSDChannel( p_vout, p_intf->p_sys->p_channels[ i ] );
+        }
     }
 }