Commit 25ec3acb authored by Steve Lhomme's avatar Steve Lhomme Committed by Thomas Guillem

vout: add vout_display_SendEventViewpointMoved

"vout display" modules can call this function to update the view point.
Signed-off-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
parent 67e1dabc
......@@ -215,6 +215,9 @@ enum {
VOUT_DISPLAY_EVENT_MOUSE_PRESSED,
VOUT_DISPLAY_EVENT_MOUSE_RELEASED,
VOUT_DISPLAY_EVENT_MOUSE_DOUBLE_CLICK,
/* VR navigation */
VOUT_DISPLAY_EVENT_VIEWPOINT_MOVED,
};
/**
......@@ -395,6 +398,11 @@ static inline void vout_display_SendEventMouseDoubleClick(vout_display_t *vd)
{
vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_MOUSE_DOUBLE_CLICK);
}
static inline void vout_display_SendEventViewpointMoved(vout_display_t *vd,
const vlc_viewpoint_t *vp)
{
vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_VIEWPOINT_MOVED, vp);
}
/**
* Asks for a new window of a given type.
......
......@@ -369,6 +369,7 @@ typedef struct {
bool ch_viewpoint;
vlc_viewpoint_t viewpoint;
vlc_viewpoint_t display_viewpoint;
/* */
video_format_t source;
......@@ -654,6 +655,11 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
VoutDisplayEventMouse(vd, event, args);
break;
case VOUT_DISPLAY_EVENT_VIEWPOINT_MOVED:
vout_SendEventViewpointMoved(osys->vout,
va_arg(args, const vlc_viewpoint_t *));
break;
case VOUT_DISPLAY_EVENT_FULLSCREEN: {
const int is_fullscreen = (int)va_arg(args, int);
const bool window_fullscreen = va_arg(args, int);
......
......@@ -52,6 +52,14 @@ static inline void vout_SendEventMouseMoved(vout_thread_t *vout, int x, int y)
{
var_SetCoords(vout, "mouse-moved", x, y);
}
static inline void vout_SendEventViewpointMoved(vout_thread_t *vout,
const vlc_viewpoint_t *p_viewpoint)
{
var_SetAddress(vout, "viewpoint-moved", (void *) p_viewpoint);
/* This variable can only be read from callbacks */
var_Change(vout, "viewpoint-moved", VLC_VAR_SETVALUE,
&(vlc_value_t) { .p_address = NULL }, NULL);
}
static inline void vout_SendEventMousePressed(vout_thread_t *vout, int button)
{
int key = KEY_UNSET;
......
......@@ -300,6 +300,9 @@ void vout_IntfInit( vout_thread_t *p_vout )
var_Create( p_vout, "mouse-moved", VLC_VAR_COORDS );
var_Create( p_vout, "mouse-clicked", VLC_VAR_COORDS );
/* Device orientation */
var_Create( p_vout, "viewpoint-moved", VLC_VAR_ADDRESS );
/* Viewpoint */
var_Create( p_vout, "viewpoint", VLC_VAR_ADDRESS );
var_AddCallback( p_vout, "viewpoint", ViewpointCallback, NULL );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment