Skip to content

Commit

Permalink
hotkeys: new hotkeys to change the viewpoint in 360° videos
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
robUx4 authored and tguillem committed Nov 15, 2016
1 parent e23cb34 commit 1e4c227
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 6 deletions.
3 changes: 3 additions & 0 deletions include/vlc_keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
44 changes: 42 additions & 2 deletions modules/control/hotkeys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 )
{
Expand Down
2 changes: 2 additions & 0 deletions src/config/keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, },
Expand Down
27 changes: 23 additions & 4 deletions src/libvlc-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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." )
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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 )
Expand Down

0 comments on commit 1e4c227

Please sign in to comment.