[vlc-commits] hotkeys: new hotkeys to change the viewpoint in 360° videos

Steve Lhomme git at videolan.org
Tue Nov 15 18:14:01 CET 2016


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Tue Nov 15 15:21:43 2016 +0100| [1e4c227201b9f35264e1088c5067641c6da2fdc4] | committer: Thomas Guillem

hotkeys: new hotkeys to change the viewpoint in 360° videos

yaw: Left/Right (same a DVD/BR nav)
pitch: Up/Down (same a DVD/BR nav)
fov: Page Up/Page Down

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1e4c227201b9f35264e1088c5067641c6da2fdc4
---

 include/vlc_keys.h        |  3 +++
 modules/control/hotkeys.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
 src/config/keys.c         |  2 ++
 src/libvlc-module.c       | 27 +++++++++++++++++++++++----
 4 files changed, 70 insertions(+), 6 deletions(-)

diff --git a/include/vlc_keys.h b/include/vlc_keys.h
index ea54950..3788e68 100644
--- a/include/vlc_keys.h
+++ b/include/vlc_keys.h
@@ -227,6 +227,9 @@ typedef enum vlc_action {
     ACTIONID_PROGRAM_SID_NEXT,
     ACTIONID_PROGRAM_SID_PREV,
     ACTIONID_INTF_POPUP_MENU,
+    /* Viewpoint */
+    ACTIONID_FOV_IN,
+    ACTIONID_FOV_OUT,
 
 } vlc_action_t;
 
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 11bb9bd..725f5f9 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -767,13 +767,40 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 var_SetInteger( p_input, "title  0", 2 );
             break;
         case ACTIONID_NAV_ACTIVATE:
+            if( p_input )
+                input_Control( p_input, INPUT_NAV_ACTIVATE, NULL );
+            break;
         case ACTIONID_NAV_UP:
+            if( p_vout )
+                input_UpdateViewpoint( p_input,
+                                       &(vlc_viewpoint_t) { .pitch = -1.f },
+                                       false );
+            if( p_input )
+                input_Control( p_input, INPUT_NAV_UP, NULL );
+            break;
         case ACTIONID_NAV_DOWN:
+            if( p_vout )
+                input_UpdateViewpoint( p_input,
+                                       &(vlc_viewpoint_t) { .pitch = 1.f },
+                                       false );
+            if( p_input )
+                input_Control( p_input, INPUT_NAV_DOWN, NULL );
+            break;
         case ACTIONID_NAV_LEFT:
+            if( p_vout )
+                input_UpdateViewpoint( p_input,
+                                       &(vlc_viewpoint_t) { .yaw = -1.f },
+                                       false );
+            if( p_input )
+                input_Control( p_input, INPUT_NAV_LEFT, NULL );
+            break;
         case ACTIONID_NAV_RIGHT:
+            if( p_vout )
+                input_UpdateViewpoint( p_input,
+                                       &(vlc_viewpoint_t) { .yaw = 1.f },
+                                       false );
             if( p_input )
-                input_Control( p_input, i_action - ACTIONID_NAV_ACTIVATE
-                               + INPUT_NAV_ACTIVATE, NULL );
+                input_Control( p_input, INPUT_NAV_RIGHT, NULL );
             break;
 
         /* Video Output actions */
@@ -892,6 +919,19 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 var_DecInteger( p_vout, "crop-right" );
             break;
 
+        case ACTIONID_FOV_IN:
+            if( p_vout )
+                input_UpdateViewpoint( p_input,
+                                       &(vlc_viewpoint_t) { .fov = -1.f },
+                                       false );
+            break;
+        case ACTIONID_FOV_OUT:
+            if( p_vout )
+                input_UpdateViewpoint( p_input,
+                                       &(vlc_viewpoint_t) { .fov = 1.f },
+                                       false );
+            break;
+
          case ACTIONID_TOGGLE_AUTOSCALE:
             if( p_vout )
             {
diff --git a/src/config/keys.c b/src/config/keys.c
index 8b8aef6..d1611f9 100644
--- a/src/config/keys.c
+++ b/src/config/keys.c
@@ -368,6 +368,8 @@ static const struct action actions[] =
     { "uncrop-right", ACTIONID_UNCROP_RIGHT, },
     { "uncrop-top", ACTIONID_UNCROP_TOP, },
     { "unzoom", ACTIONID_UNZOOM, },
+    { "viewpoint-fov-in", ACTIONID_FOV_IN, },
+    { "viewpoint-fov-out", ACTIONID_FOV_OUT, },
     { "vol-down", ACTIONID_VOL_DOWN, },
     { "vol-mute", ACTIONID_VOL_MUTE, },
     { "vol-up", ACTIONID_VOL_UP, },
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 035bcd2..7a55d1e 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -1262,13 +1262,13 @@ static const char *const mouse_wheel_texts[] = {
 #define QUIT_KEY_TEXT N_("Quit")
 #define QUIT_KEY_LONGTEXT N_("Select the hotkey to quit the application.")
 #define NAV_UP_KEY_TEXT N_("Navigate up")
-#define NAV_UP_KEY_LONGTEXT N_("Select the key to move the selector up in DVD menus.")
+#define NAV_UP_KEY_LONGTEXT N_("Select the key to move the selector up in DVD menus / Move viewpoint to up (pitch).")
 #define NAV_DOWN_KEY_TEXT N_("Navigate down")
-#define NAV_DOWN_KEY_LONGTEXT N_("Select the key to move the selector down in DVD menus.")
+#define NAV_DOWN_KEY_LONGTEXT N_("Select the key to move the selector down in DVD menus / Move viewpoint to down (pitch).")
 #define NAV_LEFT_KEY_TEXT N_("Navigate left")
-#define NAV_LEFT_KEY_LONGTEXT N_("Select the key to move the selector left in DVD menus.")
+#define NAV_LEFT_KEY_LONGTEXT N_("Select the key to move the selector left in DVD menus / Move viewpoint to left (yaw).")
 #define NAV_RIGHT_KEY_TEXT N_("Navigate right")
-#define NAV_RIGHT_KEY_LONGTEXT N_("Select the key to move the selector right in DVD menus.")
+#define NAV_RIGHT_KEY_LONGTEXT N_("Select the key to move the selector right in DVD menus / Move viewpoint to right (yaw).")
 #define NAV_ACTIVATE_KEY_TEXT N_("Activate")
 #define NAV_ACTIVATE_KEY_LONGTEXT N_("Select the key to activate selected item in DVD menus.")
 #define DISC_MENU_TEXT N_("Go to the DVD menu")
@@ -1422,6 +1422,12 @@ static const char *const mouse_wheel_texts[] = {
 #define UNCROP_RIGHT_KEY_TEXT N_("Uncrop one pixel from the right of the video")
 #define UNCROP_RIGHT_KEY_LONGTEXT N_("Uncrop one pixel from the right of the video")
 
+/* 360° Viewpoint */
+#define VIEWPOINT_FOV_IN_KEY_TEXT N_("Shrink field of view")
+#define VIEWPOINT_FOV_IN_KEY_LONGTEXT N_("Shrink the viewpoint field of view")
+#define VIEWPOINT_FOV_OUT_KEY_TEXT N_("Expand field of view")
+#define VIEWPOINT_FOV_OUT_KEY_LONGTEXT N_("Expand the viewpoint field of view")
+
 #define WALLPAPER_KEY_TEXT N_("Toggle wallpaper mode in video output")
 #define WALLPAPER_KEY_LONGTEXT N_( \
     "Toggle wallpaper mode in video output." )
@@ -2226,6 +2232,10 @@ vlc_module_begin ()
 #   define KEY_CROP_RIGHT         "Alt+l"
 #   define KEY_UNCROP_RIGHT       "Alt+Shift+l"
 
+/* 360° Viewpoint */
+#   define KEY_VIEWPOINT_FOV_IN   "Page Up"
+#   define KEY_VIEWPOINT_FOV_OUT  "Page Down"
+
 /* the macosx-interface already has bindings */
 #   define KEY_ZOOM_QUARTER       NULL
 #   define KEY_ZOOM_HALF          "Command+0"
@@ -2369,6 +2379,10 @@ vlc_module_begin ()
 #   define KEY_CROP_RIGHT         "Alt+f"
 #   define KEY_UNCROP_RIGHT       "Alt+Shift+f"
 
+/* 360° Viewpoint */
+#   define KEY_VIEWPOINT_FOV_IN   "Page Up"
+#   define KEY_VIEWPOINT_FOV_OUT  "Page Down"
+
 /* Zooming */
 #   define KEY_ZOOM_QUARTER       "Alt+1"
 #   define KEY_ZOOM_HALF          "Alt+2"
@@ -2562,6 +2576,11 @@ vlc_module_begin ()
     add_key( "key-loop", KEY_LOOP,
              LOOP_KEY_TEXT, LOOP_KEY_LONGTEXT, false )
 
+    add_key( "key-viewpoint-fov-in", KEY_VIEWPOINT_FOV_IN,
+             VIEWPOINT_FOV_IN_KEY_TEXT, VIEWPOINT_FOV_IN_KEY_LONGTEXT, true )
+    add_key( "key-viewpoint-fov-out", KEY_VIEWPOINT_FOV_OUT,
+             VIEWPOINT_FOV_OUT_KEY_TEXT, VIEWPOINT_FOV_OUT_KEY_LONGTEXT, true )
+
     set_section ( N_("Zoom" ), NULL )
     add_key( "key-zoom-quarter",  KEY_ZOOM_QUARTER,
         ZOOM_QUARTER_KEY_TEXT,  NULL, false )



More information about the vlc-commits mailing list