]> git.sesse.net Git - vlc/commitdiff
Add hotkey to cycle through program SIDs.
authorZoran Turalija <zoran.turalija@gmail.com>
Mon, 13 Aug 2012 05:54:04 +0000 (07:54 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 16 Aug 2012 14:25:10 +0000 (16:25 +0200)
Allow far more easier cycling through program Service IDs in multi-program
stream eg. DVB streams.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
include/vlc_keys.h
modules/control/hotkeys.c
src/config/keys.c
src/libvlc-module.c

index c46b19ca410a754443d7e766290766e6d52563fc..a04847c4f30922b31a9c30ee9fc8ed4996d68dac 100644 (file)
@@ -200,6 +200,8 @@ typedef enum vlc_action {
     ACTIONID_RATE_NORMAL,
     ACTIONID_RATE_SLOWER_FINE,
     ACTIONID_RATE_FASTER_FINE,
+    /* Cycle Through Program Service IDs */
+    ACTIONID_PROGRAM_SID,
 
 } vlc_action_t;
 
index dcbef2803fdd8821aea5531c2e49eb3adc898f95..25af282ad4e838a8b6473165e2533a09352787f1 100644 (file)
@@ -501,6 +501,46 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                                 list2.p_list->p_values[i].psz_string );
                 var_FreeList( &list, &list2 );
             }
+            else if( i_action == ACTIONID_PROGRAM_SID )
+            {
+                vlc_value_t val, list, list2;
+                int i_count, i;
+                var_Get( p_input, "program", &val );
+
+                var_Change( p_input, "program", VLC_VAR_GETCHOICES,
+                            &list, &list2 );
+                i_count = list.p_list->i_count;
+                if( i_count <= 1 )
+                {
+                    DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                    _("Program Service ID: %s"), _("N/A") );
+                    var_FreeList( &list, &list2 );
+                    goto cleanup_and_continue;
+                }
+                for( i = 0; i < i_count; i++ )
+                {
+                    if( val.i_int == list.p_list->p_values[i].i_int )
+                    {
+                        break;
+                    }
+                }
+                /* value of program 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++;
+                var_Set( p_input, "program", list.p_list->p_values[i] );
+                DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                _("Program Service ID: %s"),
+                                list2.p_list->p_values[i].psz_string );
+                var_FreeList( &list, &list2 );
+            }
             else if( i_action == ACTIONID_ASPECT_RATIO && p_vout )
             {
                 vlc_value_t val={0}, val_list, text_list;
index 24c3061eb19bb03efce93e51e1db5c52e1adc5cb..25882957b4deac8000b592e25c9b98bc7c6a37d0 100644 (file)
@@ -307,6 +307,7 @@ static const struct action actions[] =
     { "play-pause", ACTIONID_PLAY_PAUSE, },
     { "position", ACTIONID_POSITION, },
     { "prev", ACTIONID_PREV, },
+    { "program-sid", ACTIONID_PROGRAM_SID, },
     { "quit", ACTIONID_QUIT, },
     { "random", ACTIONID_RANDOM, },
     { "rate-faster-fine", ACTIONID_RATE_FASTER_FINE, },
index 8ed7a3837e1ca3e2fb82256829266fa682d5320f..aa0d44585f436873b0d46a58f457f84d9c63c2ba 100644 (file)
@@ -1365,6 +1365,8 @@ static const char *const ppsz_albumart_descriptions[] =
 #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 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")
@@ -2319,6 +2321,7 @@ vlc_module_begin ()
 
 #   define KEY_AUDIO_TRACK        "b"
 #   define KEY_SUBTITLE_TRACK     "v"
+#   define KEY_PROGRAM_SID        "x"
 #   define KEY_ASPECT_RATIO       "a"
 #   define KEY_CROP               "c"
 #   define KEY_TOGGLE_AUTOSCALE   "o"
@@ -2483,6 +2486,8 @@ 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-aspect-ratio", KEY_ASPECT_RATIO,
              ASPECT_RATIO_KEY_TEXT, ASPECT_RATIO_KEY_LONGTEXT, false )
     add_key( "key-crop", KEY_CROP,