Add hotkeys to cycle through previous/next program SIDs.
authorZoran Turalija <zoran.turalija@gmail.com>
Thu, 28 Mar 2013 13:46:05 +0000 (14:46 +0100)
committerRémi Denis-Courmont <remi@remlab.net>
Thu, 28 Mar 2013 16:26:13 +0000 (18:26 +0200)
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@remlab.net>
include/vlc_keys.h
modules/control/hotkeys.c
src/config/keys.c
src/libvlc-module.c

index 59c6151..141e4b9 100644 (file)
@@ -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;
index 42e3ba0..95bc0d0 100644 (file)
@@ -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 );
index 738625d..ee3c382 100644 (file)
@@ -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, },
index 522d48a..34a229e 100644 (file)
@@ -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,