[vlc-commits] Add hotkeys to cycle through previous/next program SIDs.
Zoran Turalija
git at videolan.org
Thu Mar 28 17:38:00 CET 2013
vlc | branch: master | Zoran Turalija <zoran.turalija at gmail.com> | Thu Mar 28 14:46:05 2013 +0100| [e8dc8779bfe94361e9a1d531c4955d0cd31a0ed2] | committer: Rémi Denis-Courmont
Add hotkeys to cycle through previous/next program SIDs.
Change "cycle through program SIDs" to support cycle both ways (prev/next).
With this commit, it is possible e.g. to quickly change between neighbor
program SIDs back and forth in multi-program stream like DVB streams using
default x/Shift+x keys.
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e8dc8779bfe94361e9a1d531c4955d0cd31a0ed2
---
include/vlc_keys.h | 3 ++-
modules/control/hotkeys.c | 21 +++++++++++++++------
src/config/keys.c | 3 ++-
src/libvlc-module.c | 18 ++++++++++++------
4 files changed, 31 insertions(+), 14 deletions(-)
diff --git a/include/vlc_keys.h b/include/vlc_keys.h
index 59c6151..141e4b9 100644
--- a/include/vlc_keys.h
+++ b/include/vlc_keys.h
@@ -213,7 +213,8 @@ typedef enum vlc_action {
ACTIONID_RATE_SLOWER_FINE,
ACTIONID_RATE_FASTER_FINE,
/* Cycle Through Program Service IDs */
- ACTIONID_PROGRAM_SID,
+ ACTIONID_PROGRAM_SID_NEXT,
+ ACTIONID_PROGRAM_SID_PREV,
ACTIONID_INTF_POPUP_MENU,
} vlc_action_t;
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 42e3ba0..95bc0d0 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -476,7 +476,8 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
var_FreeList( &list, &list2 );
}
break;
- case ACTIONID_PROGRAM_SID:
+ case ACTIONID_PROGRAM_SID_NEXT:
+ case ACTIONID_PROGRAM_SID_PREV:
if( p_input )
{
vlc_value_t val, list, list2;
@@ -500,17 +501,25 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
break;
}
}
- /* value of program was not in choices list */
+ /* value of program sid was not in choices list */
if( i == i_count )
{
msg_Warn( p_input,
"invalid current program SID, selecting 0" );
i = 0;
}
- else if( i == i_count - 1 )
- i = 0;
- else
- i++;
+ else if( i_action == ACTIONID_PROGRAM_SID_NEXT ) {
+ if( i == i_count - 1 )
+ i = 0;
+ else
+ i++;
+ }
+ else { /* ACTIONID_PROGRAM_SID_PREV */
+ if( i == 0 )
+ i = i_count - 1;
+ else
+ i--;
+ }
var_Set( p_input, "program", list.p_list->p_values[i] );
DisplayMessage( p_vout, _("Program Service ID: %s"),
list2.p_list->p_values[i].psz_string );
diff --git a/src/config/keys.c b/src/config/keys.c
index 738625d..ee3c382 100644
--- a/src/config/keys.c
+++ b/src/config/keys.c
@@ -321,7 +321,8 @@ static const struct action actions[] =
{ "play-pause", ACTIONID_PLAY_PAUSE, },
{ "position", ACTIONID_POSITION, },
{ "prev", ACTIONID_PREV, },
- { "program-sid", ACTIONID_PROGRAM_SID, },
+ { "program-sid-next", ACTIONID_PROGRAM_SID_NEXT, },
+ { "program-sid-prev", ACTIONID_PROGRAM_SID_PREV, },
{ "quit", ACTIONID_QUIT, },
{ "random", ACTIONID_RANDOM, },
{ "rate-faster-fine", ACTIONID_RATE_FASTER_FINE, },
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 522d48a..34a229e 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -1364,8 +1364,10 @@ static const char *const mouse_wheel_texts[] =
#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 PROGRAM_SID_KEY_TEXT N_("Cycle program Service ID")
-#define PROGRAM_SID_KEY_LONGTEXT N_("Cycle through the available program Service IDs (SIDs).")
+#define PROGRAM_SID_NEXT_KEY_TEXT N_("Cycle next program Service ID")
+#define PROGRAM_SID_NEXT_KEY_LONGTEXT N_("Cycle through the available next program Service IDs (SIDs).")
+#define PROGRAM_SID_PREV_KEY_TEXT N_("Cycle previous program Service ID")
+#define PROGRAM_SID_PREV_KEY_LONGTEXT N_("Cycle through the available previous program Service IDs (SIDs).")
#define ASPECT_RATIO_KEY_TEXT N_("Cycle source aspect ratio")
#define ASPECT_RATIO_KEY_LONGTEXT N_("Cycle through a predefined list of source aspect ratios.")
#define CROP_KEY_TEXT N_("Cycle video crop")
@@ -2182,7 +2184,8 @@ vlc_module_begin ()
# define KEY_AUDIODELAY_DOWN "f"
# define KEY_AUDIO_TRACK "l"
# define KEY_SUBTITLE_TRACK "s"
-# define KEY_PROGRAM_SID "x"
+# define KEY_PROGRAM_SID_NEXT "x"
+# define KEY_PROGRAM_SID_PREV "Shift+x"
# define KEY_ASPECT_RATIO "a"
# define KEY_CROP "c"
# define KEY_TOGGLE_AUTOSCALE "o"
@@ -2294,7 +2297,8 @@ vlc_module_begin ()
# define KEY_AUDIO_TRACK "b"
# define KEY_SUBTITLE_TRACK "v"
-# define KEY_PROGRAM_SID "x"
+# define KEY_PROGRAM_SID_NEXT "x"
+# define KEY_PROGRAM_SID_PREV "Shift+x"
# define KEY_ASPECT_RATIO "a"
# define KEY_CROP "c"
# define KEY_TOGGLE_AUTOSCALE "o"
@@ -2452,8 +2456,10 @@ vlc_module_begin ()
AUDI_DEVICE_CYCLE_KEY_LONGTEXT, false )
add_key( "key-subtitle-track", KEY_SUBTITLE_TRACK,
SUBTITLE_TRACK_KEY_TEXT, SUBTITLE_TRACK_KEY_LONGTEXT, false )
- add_key( "key-program-sid", KEY_PROGRAM_SID,
- PROGRAM_SID_KEY_TEXT, PROGRAM_SID_KEY_LONGTEXT, false )
+ add_key( "key-program-sid-next", KEY_PROGRAM_SID_NEXT,
+ PROGRAM_SID_NEXT_KEY_TEXT, PROGRAM_SID_NEXT_KEY_LONGTEXT, false )
+ add_key( "key-program-sid-prev", KEY_PROGRAM_SID_PREV,
+ PROGRAM_SID_PREV_KEY_TEXT, PROGRAM_SID_PREV_KEY_LONGTEXT, false )
add_key( "key-aspect-ratio", KEY_ASPECT_RATIO,
ASPECT_RATIO_KEY_TEXT, ASPECT_RATIO_KEY_LONGTEXT, false )
add_key( "key-crop", KEY_CROP,
More information about the vlc-commits
mailing list