From 1e4c227201b9f35264e1088c5067641c6da2fdc4 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Tue, 15 Nov 2016 15:21:43 +0100 Subject: [PATCH] =?UTF-8?q?hotkeys:=20new=20hotkeys=20to=20change=20the=20?= =?UTF-8?q?viewpoint=20in=20360=C2=B0=20videos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- include/vlc_keys.h | 3 +++ modules/control/hotkeys.c | 52 ++++++++++++++++++++++++++++++++++----- src/config/keys.c | 2 ++ src/libvlc-module.c | 27 +++++++++++++++++--- 4 files changed, 74 insertions(+), 10 deletions(-) diff --git a/include/vlc_keys.h b/include/vlc_keys.h index ea5495034c..3788e6812d 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 11bb9bd23a..725f5f9a99 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: - case ACTIONID_NAV_UP: - case ACTIONID_NAV_DOWN: - case ACTIONID_NAV_LEFT: - case ACTIONID_NAV_RIGHT: if( p_input ) - input_Control( p_input, i_action - ACTIONID_NAV_ACTIVATE - + INPUT_NAV_ACTIVATE, NULL ); + 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, 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 8b8aef67b8..d1611f9cea 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 035bcd2e1f..7a55d1e589 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 )