[vlc-devel] [PATCH] Shortcut for multiplied video tracks

Rémi Denis-Courmont remi at remlab.net
Tue Feb 28 08:29:06 CET 2017


On February 28, 2017 4:29:50 AM GMT+02:00, Andrei Ciurea <andrei.ciurea96 at gmail.com> wrote:
>
>diff --git a/include/vlc_keys.h b/include/vlc_keys.h
>index 8d8df53..0146e58 100644
>--- a/include/vlc_keys.h
>+++ b/include/vlc_keys.h
>@@ -100,6 +100,7 @@
> #define KEY_ZOOM_OUT         0x00610000
> #define KEY_BRIGHTNESS_UP    0x00620000
> #define KEY_BRIGHTNESS_DOWN  0x00630000
>+#define KEY_MEDIA_VIDEO      0x00640000
> 
> #define KEY_MOUSEWHEELUP     0x00F00000
> #define KEY_MOUSEWHEELDOWN   0x00F10000
>@@ -171,6 +172,7 @@ typedef enum vlc_action {
>     ACTIONID_SUBPOS_UP,
>     ACTIONID_SUBPOS_DOWN,
>     ACTIONID_AUDIO_TRACK,
>+    ACTIONID_VIDEO_TRACK,
>     ACTIONID_SUBTITLE_TRACK,
>     ACTIONID_SUBTITLE_TOGGLE,
>     ACTIONID_SUBTITLE_TEXT_SCALE_NORMAL,
>diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
>index 4e4f368..57a04e0 100644
>--- a/modules/control/hotkeys.c
>+++ b/modules/control/hotkeys.c
>@@ -700,17 +700,23 @@ static int PutAction( intf_thread_t *p_intf,
>input_thread_t *p_input,
>             }
>             break;
>         }
>-
>+        case ACTIONID_VIDEO_TRACK:
>         case ACTIONID_AUDIO_TRACK:
>-            if( p_input )
>+          if( p_input )
>             {
>                 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,
>+                const char *video_audio_es = "audio-es";
>+                const char *dispMessaje = "Audio track: %s";
>+
>+                if(i_action == ACTIONID_VIDEO_TRACK){
>+                    video_audio_es = "video-es";
>+                    dispMessaje = "Video track: %s";
>+                }
>+                var_Get( p_input, video_audio_es, &val );
>+                var_Change( p_input, video_audio_es,
>VLC_VAR_GETCHOICES,
>                             &list, &list2 );
>-                i_count = list.p_list->i_count;
>-                if( i_count > 1 )
>+                if( (i_count = list.p_list->i_count) > 1 )
>                 {
>                     for( i = 0; i < i_count; i++ )
>                     {
>@@ -719,7 +725,7 @@ static int PutAction( intf_thread_t *p_intf,
>input_thread_t *p_input,
>                             break;
>                         }
>                     }
>-                    /* value of audio-es was not in choices list */
>+                    /* value of audio-es / video-es was not in choices
>list */
>                     if( i == i_count )
>                     {
>                         msg_Warn( p_input,
>@@ -730,13 +736,14 @@ static int PutAction( intf_thread_t *p_intf,
>input_thread_t *p_input,
>                         i = 1;
>                     else
>                         i++;
>-                    var_Set( p_input, "audio-es",
>list.p_list->p_values[i] );
>-                    DisplayMessage( p_vout, _("Audio track: %s"),
>+                    var_Set( p_input, video_audio_es,
>list.p_list->p_values[i] );
>+                    DisplayMessage( p_vout, _(dispMessaje),
>                                list2.p_list->p_values[i].psz_string );
>+                
>                 }
>                 var_FreeList( &list, &list2 );
>             }
>-            break;
>+            break;  
>         case ACTIONID_SUBTITLE_TRACK:
>             if( p_input )
>             {
>diff --git a/src/config/keys.c b/src/config/keys.c
>index 336466b..837424b 100644
>--- a/src/config/keys.c
>+++ b/src/config/keys.c
>@@ -86,6 +86,7 @@ static const struct key_descriptor_s vlc_keys[] =
>     { N_("Left"),              KEY_LEFT              },
>     { N_("Media Angle"),       KEY_MEDIA_ANGLE       },
>     { N_("Media Audio Track"), KEY_MEDIA_AUDIO       },
>+    { N_("Media Video Track"), KEY_MEDIA_VIDEO       }, 
>     { N_("Media Forward"),     KEY_MEDIA_FORWARD     },
>     { N_("Media Menu"),        KEY_MEDIA_MENU        },
>     { N_("Media Next Frame"),  KEY_MEDIA_FRAME_NEXT  },
>@@ -273,6 +274,7 @@ static const struct action actions[] =
>     /* *MUST* be sorted (ASCII order) */
>     { "aspect-ratio", ACTIONID_ASPECT_RATIO, },
>     { "audio-track", ACTIONID_AUDIO_TRACK, },
>+    { "video-track", ACTIONID_VIDEO_TRACK, },
>     { "audiodelay-down", ACTIONID_AUDIODELAY_DOWN, },
>     { "audiodelay-up", ACTIONID_AUDIODELAY_UP, },
>     { "audiodevice-cycle", ACTIONID_AUDIODEVICE_CYCLE, },
>diff --git a/src/libvlc-module.c b/src/libvlc-module.c
>index 6d60e80..31aa346 100644
>--- a/src/libvlc-module.c
>+++ b/src/libvlc-module.c
>@@ -1357,6 +1357,8 @@ static const char *const mouse_wheel_texts[] = {
> 
> #define AUDIO_TRACK_KEY_TEXT N_("Cycle audio track")
>#define AUDIO_TRACK_KEY_LONGTEXT N_("Cycle through the available audio
>tracks(languages).")
>+#define VIDEO_TRACK_KEY_TEXT N_("Cycle video track")
>+#define VIDEO_TRACK_KEY_LONGTEXT N_("Cycle through the available video
>tracks.")
> #define SUBTITLE_TRACK_KEY_TEXT N_("Cycle subtitle track")
>#define SUBTITLE_TRACK_KEY_LONGTEXT N_("Cycle through the available
>subtitle tracks.")
> #define SUBTITLE_TOGGLE_KEY_TEXT N_("Toggle subtitles")
>@@ -2198,6 +2200,7 @@ vlc_module_begin ()
> #   define KEY_AUDIODELAY_UP      "g"
> #   define KEY_AUDIODELAY_DOWN    "f"
> #   define KEY_AUDIO_TRACK        "l"
>+#   define KEY_VIDEO_TRACK        "/"
> #   define KEY_SUBTITLE_TRACK     "s"
> #   define KEY_SUBTITLE_TOGGLE    "Shift+s"
> #   define KEY_PROGRAM_SID_NEXT   "x"
>@@ -2340,6 +2343,7 @@ vlc_module_begin ()
> #   define KEY_LOOP               "l"
> 
> #   define KEY_AUDIO_TRACK        "b"
>+#   define KEY_VIDEO_TRACK        "/"
> #   define KEY_SUBTITLE_TRACK     "v"
> #   define KEY_SUBTITLE_TOGGLE    "Shift+v"
> #   define KEY_PROGRAM_SID_NEXT   "x"
>@@ -2512,6 +2516,8 @@ vlc_module_begin ()
>         AUDIODELAY_DOWN_KEY_TEXT, AUDIODELAY_DOWN_KEY_LONGTEXT, true )
>     add_key( "key-audio-track", KEY_AUDIO_TRACK, AUDIO_TRACK_KEY_TEXT,
>              AUDIO_TRACK_KEY_LONGTEXT, false )
>+    add_key( "key-video-track", KEY_VIDEO_TRACK, VIDEO_TRACK_KEY_TEXT,
>+             VIDEO_TRACK_KEY_LONGTEXT, false )
>add_key( "key-audiodevice-cycle", KEY_AUDIODEVICE_CYCLE,
>AUDI_DEVICE_CYCLE_KEY_TEXT,
>              AUDI_DEVICE_CYCLE_KEY_LONGTEXT, false )
>     add_key( "key-subtitle-track", KEY_SUBTITLE_TRACK,
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

Hello.

I think this breaks gettext message extraction.
-- 
Rémi Denis-Courmont


More information about the vlc-devel mailing list