]> git.sesse.net Git - vlc/commitdiff
hadded keys to cycle audio track and subtitle track
authorSigmund Augdal Helberg <sigmunau@videolan.org>
Wed, 7 Jul 2004 21:09:20 +0000 (21:09 +0000)
committerSigmund Augdal Helberg <sigmunau@videolan.org>
Wed, 7 Jul 2004 21:09:20 +0000 (21:09 +0000)
modules/control/hotkeys.c
src/libvlc.h

index 8f46c0381520b769479f13c8dfbe233c81a07c5a..c11feaa0f6fec7b4397692d78bd5a8ddfe108335 100755 (executable)
@@ -407,6 +407,82 @@ 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;
+                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[0] );
+                    i = 0;
+                }
+                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,
index a97ddea5651ac6d82216c37bbe77f1dc5dc12d67..2ae5f5323abd6ada31612183f1839b056b283b51 100644 (file)
@@ -722,6 +722,11 @@ static char *ppsz_align_descriptions[] =
 #define HISTORY_FORWARD_TEXT N_("Go forward in browsing history")
 #define HISTORY_FORWARD_LONGTEXT N_("Select the key to go forward (to the next media item) in the browsing history.")
 
+#define AUDIO_TRACK_KEY_TEXT N_("Cycle audio track")
+#define AUDIO_TRACK_KEY_LONGTEXT N_("Cycle through the available audio tracks(languages)")
+#define SUBTITLE_TRACK_KEY_TEXT N_("Cycle subtitle track")
+#define SUBTITLE_TRACK_KEY_LONGTEXT N_("Cycle through the available subtitle tracks")
+
 #define PLAYLIST_USAGE N_("\nPlaylist items:" \
     "\n  *.mpg, *.vob                   plain MPEG-1/2 files" \
     "\n  [dvd://][device][@raw_device][@[title][,[chapter][,angle]]]" \
@@ -1107,6 +1112,8 @@ vlc_module_begin();
     add_key( "key-play-bookmark10", KEY_F10, NULL, PLAY_BOOKMARK10_KEY_TEXT, PLAY_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
     add_key( "key-history-back", KEY_MODIFIER_CTRL|'[', NULL, HISTORY_BACK_TEXT, HISTORY_BACK_LONGTEXT, VLC_TRUE );
     add_key( "key-history-forward", KEY_MODIFIER_CTRL|']', NULL, HISTORY_FORWARD_TEXT, HISTORY_FORWARD_LONGTEXT, VLC_TRUE );
+    add_key( "key-audio-track", 'l', NULL, AUDIO_TRACK_KEY_TEXT, AUDIO_TRACK_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-subtitle-track", 's', NULL, SUBTITLE_TRACK_KEY_TEXT, SUBTITLE_TRACK_KEY_LONGTEXT, VLC_FALSE );
 #endif
 
     /* Usage (mainly useful for cmd line stuff) */
@@ -1197,5 +1204,7 @@ static struct hotkey p_hotkeys[] =
     { "key-play-bookmark10", ACTIONID_PLAY_BOOKMARK10, 0},
     { "key-history-back", ACTIONID_HISTORY_BACK, 0},
     { "key-history-forward", ACTIONID_HISTORY_FORWARD, 0},
+    { "key-audio-track", ACTIONID_AUDIO_TRACK, 0},
+    { "key-subtitle-track", ACTIONID_SUBTITLE_TRACK, 0},
     { NULL, 0, 0 }
 };