[vlc-devel] [PATCH 0/1] Define new keyboard shortcut

Antoine Huchet antoine+vlc at huchet.me
Wed Apr 3 15:19:20 CEST 2019


This is an attempt to fix https://trac.videolan.org/vlc/ticket/5708.
This is based on https://github.com/tguillem/vlc branch qml/38.

I made it two commits.
I changed the shortcut from semicolon to 'q'.

As for too fringe, I'll let you guys decide.

---
 include/vlc_actions.h | 4 +++-
 src/libvlc-module.c   | 7 +++++++
 src/misc/actions.c    | 2 ++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/include/vlc_actions.h b/include/vlc_actions.h
index 62f0afae53..15a836b338 100644
--- a/include/vlc_actions.h
+++ b/include/vlc_actions.h
@@ -109,6 +109,7 @@ libvlc_InternalActionsClean(libvlc_int_t *p_libvlc);
 #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
@@ -180,8 +181,9 @@ typedef enum vlc_action_id {
     ACTIONID_CHAPTER_PREV,
     ACTIONID_CHAPTER_NEXT,
     ACTIONID_DISC_MENU,
-    /* audio / subtitle track */
+    /* audio / video / subtitle track */
     ACTIONID_AUDIO_TRACK,
+    ACTIONID_VIDEO_TRACK,
     ACTIONID_SUBTITLE_REVERSE_TRACK,
     ACTIONID_SUBTITLE_TRACK,
     /* audio / subtitle delay */
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index b6c119668e..1a7b53df4b 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -1430,6 +1430,9 @@ 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_REVERSE_TRACK_KEY_TEXT N_("Cycle subtitle track in
reverse order")
 #define SUBTITLE_REVERSE_TRACK_KEY_LONGTEXT N_("Cycle through the
available subtitle tracks in reverse order.")
 #define SUBTITLE_TRACK_KEY_TEXT N_("Cycle subtitle track")
@@ -2322,6 +2325,7 @@ vlc_module_begin ()
 #   define KEY_AUDIODELAY_UP      "g"
 #   define KEY_AUDIODELAY_DOWN    "f"
 #   define KEY_AUDIO_TRACK        "l"
+#   define KEY_VIDEO_TRACK        "q"
 #   define KEY_SUBTITLE_TRACK     "s"
 #   define KEY_SUBTITLE_TOGGLE    "Shift+s"
 #   define KEY_SUBTITLE_REVTRACK  "Alt+s"
@@ -2465,6 +2469,7 @@ vlc_module_begin ()
 #   define KEY_LOOP               "l"

 #   define KEY_AUDIO_TRACK        "b"
+#   define KEY_VIDEO_TRACK        "q"
 #   define KEY_SUBTITLE_TRACK     "v"
 #   define KEY_SUBTITLE_TOGGLE    "Shift+v"
 #   define KEY_SUBTITLE_REVTRACK  "Alt+v"
@@ -2627,6 +2632,8 @@ vlc_module_begin ()
             AUDIODELAY_DOWN_KEY_TEXT, AUDIODELAY_DOWN_KEY_LONGTEXT)
     add_key("key-audio-track", KEY_AUDIO_TRACK, AUDIO_TRACK_KEY_TEXT,
             AUDIO_TRACK_KEY_LONGTEXT)
+   add_key( "key-video-track", KEY_VIDEO_TRACK, VIDEO_TRACK_KEY_TEXT,
+            VIDEO_TRACK_KEY_LONGTEXT)
     add_key("key-audiodevice-cycle", KEY_AUDIODEVICE_CYCLE,
             AUDIO_DEVICE_CYCLE_KEY_TEXT,
             AUDIO_DEVICE_CYCLE_KEY_LONGTEXT)
diff --git a/src/misc/actions.c b/src/misc/actions.c
index e10eb94790..e028152404 100644
--- a/src/misc/actions.c
+++ b/src/misc/actions.c
@@ -81,6 +81,7 @@ static const struct key_descriptor
     { 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  },
@@ -362,6 +363,7 @@ static const struct name2action
     { "uncrop-right", ACTIONID_UNCROP_RIGHT, },
     { "uncrop-top", ACTIONID_UNCROP_TOP, },
     { "unzoom", ACTIONID_UNZOOM, },
+    { "video-track", ACTIONID_VIDEO_TRACK, },
     { "viewpoint-fov-in", ACTIONID_VIEWPOINT_FOV_IN, },
     { "viewpoint-fov-out", ACTIONID_VIEWPOINT_FOV_OUT, },
     { "viewpoint-roll-anticlock", ACTIONID_VIEWPOINT_ROLL_ANTICLOCK, },
-- 
2.19.1

-- 
Antoine Huchet


More information about the vlc-devel mailing list