[vlc-commits] ncurses: add shortcuts to cycle through audio/subs tracks
Rafaël Carré
git at videolan.org
Mon Jul 8 22:40:38 CEST 2013
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Mon Jul 8 20:01:44 2013 +0200| [e6c890d1f9db3517645e5bb23a9f6c4c6c88a66c] | committer: Rafaël Carré
ncurses: add shortcuts to cycle through audio/subs tracks
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e6c890d1f9db3517645e5bb23a9f6c4c6c88a66c
---
modules/gui/ncurses.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index ed4617b..4d8441b 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -880,6 +880,9 @@ static int DrawHelp(intf_thread_t *intf)
H(_(" s Stop"));
H(_(" <space> Pause/Play"));
H(_(" f Toggle Fullscreen"));
+ H(_(" c Cycle through audio tracks"));
+ H(_(" v Cycle through subtitles tracks"));
+ H(_(" b Cycle through video tracks"));
H(_(" n, p Next/Previous playlist item"));
H(_(" [, ] Next/Previous title"));
H(_(" <, > Next/Previous chapter"));
@@ -1543,6 +1546,30 @@ static void InputNavigate(input_thread_t* p_input, const char *var)
var_TriggerCallback(p_input, var);
}
+static void CycleESTrack(intf_sys_t *sys, const char *var)
+{
+ input_thread_t *input = sys->p_input;
+
+ if (!input)
+ return;
+
+ vlc_value_t val;
+ if (var_Change(input, var, VLC_VAR_GETLIST, &val, NULL) < 0)
+ return;
+
+ vlc_list_t *list = val.p_list;
+ int64_t current = var_GetInteger(input, var);
+
+ int i;
+ for (i = 0; i < list->i_count; i++)
+ if (list->p_values[i].i_int == current)
+ break;
+
+ if (++i >= list->i_count)
+ i = 0;
+ var_SetInteger(input, var, list->p_values[i].i_int);
+}
+
static void HandleCommonKey(intf_thread_t *intf, int key)
{
intf_sys_t *sys = intf->p_sys;
@@ -1611,6 +1638,10 @@ static void HandleCommonKey(intf_thread_t *intf, int key)
case 'z': playlist_VolumeDown(p_playlist, 1, NULL); break;
case 'm': playlist_MuteToggle(p_playlist); break;
+ case 'c': CycleESTrack(sys, "audio-es"); break;
+ case 'v': CycleESTrack(sys, "spu-es"); break;
+ case 'b': CycleESTrack(sys, "video-es"); break;
+
case 0x0c: /* ^l */
case KEY_CLEAR:
break;
More information about the vlc-commits
mailing list