[vlc-devel] [PATCH 02/16] core: pass the viewpoint zoom/field of view with the yaw/pitch/roll
Thomas Guillem
thomas at gllm.fr
Wed Nov 9 18:32:56 CET 2016
From: Steve Lhomme <robux4 at videolabs.io>
These changes allow for changes in the fov and zoom property of a viewpoint,
effectivelly allowing further adjustments on what to display in the current
projection mode.
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
---
include/vlc_vout.h | 2 ++
src/libvlc-module.c | 14 ++++++++++++++
src/playlist/engine.c | 4 ++++
src/video_output/display.c | 10 ++++++++--
src/video_output/video_output.c | 2 ++
5 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/include/vlc_vout.h b/include/vlc_vout.h
index cc53079..9d693fb 100644
--- a/include/vlc_vout.h
+++ b/include/vlc_vout.h
@@ -87,6 +87,8 @@ struct vlc_viewpoint_t {
int32_t yaw; /* yaw in radians * 10,000 */
int32_t pitch; /* pitch in radians * 10,000 */
int32_t roll; /* roll in radians * 10,000 */
+ int32_t fov; /* field of view in radians * 10,000 */
+ int32_t zoom; /* zoom factor * 10,000, default to 0.0 */
};
/*****************************************************************************
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 05b171d..49bb2da 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -448,6 +448,14 @@ static const char *const ppsz_pos_descriptions[] =
"This forces the user viewpoint roll (head tilting) for the displayed " \
"video, in radians." )
+#define VIEWPOINT_FOV_TEXT N_("Viewpoint Field Of View")
+#define VIEWPOINT_FOV_LONGTEXT N_( \
+ "This forces the user viewpoint field of view for the displayed video, in "\
+ "radians." )
+
+#define VIEWPOINT_ZOOM_TEXT N_("Viewpoint Zoom")
+#define VIEWPOINT_ZOOM_LONGTEXT N_( \
+ "This forces the user viewpoint zoom factor for the displayed video." )
#define AUTOSCALE_TEXT N_("Video Auto Scaling")
#define AUTOSCALE_LONGTEXT N_( \
@@ -1614,6 +1622,12 @@ vlc_module_begin ()
add_float( "viewpoint-roll", 0.,
VIEWPOINT_ROLL_TEXT, VIEWPOINT_ROLL_LONGTEXT, false )
change_safe ()
+ add_float( "viewpoint-fov", 0.,
+ VIEWPOINT_FOV_TEXT, VIEWPOINT_FOV_LONGTEXT, false )
+ change_safe ()
+ add_float( "viewpoint-zoom", 0.,
+ VIEWPOINT_ZOOM_TEXT, VIEWPOINT_ZOOM_LONGTEXT, false )
+ change_safe ()
add_bool( "autoscale", true, AUTOSCALE_TEXT, AUTOSCALE_LONGTEXT, false )
change_safe ()
add_obsolete_float( "scale" ) /* since 3.0.0 */
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index e179a69..b347e40 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -487,6 +487,10 @@ static void VariablesInit( playlist_t *p_playlist )
* VLC_VIEWPOINT_RADIAN_UNIT;
p_vp->roll = var_InheritFloat( p_playlist, "viewpoint-roll" )
* VLC_VIEWPOINT_RADIAN_UNIT;
+ p_vp->fov = var_InheritFloat( p_playlist, "viewpoint-fov" )
+ * VLC_VIEWPOINT_RADIAN_UNIT;
+ p_vp->zoom = var_InheritFloat( p_playlist, "viewpoint-zoom" )
+ * VLC_VIEWPOINT_RADIAN_UNIT;
var_Create( p_playlist, "viewpoint", VLC_VAR_ADDRESS );
var_SetAddress( p_playlist, "viewpoint", p_vp );
diff --git a/src/video_output/display.c b/src/video_output/display.c
index ee3ac0a..52f533d 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -1231,7 +1231,9 @@ void vout_UpdateDisplayViewpoint(vout_display_t *vd,
if (absolute) {
if (osys->viewpoint.yaw != p_viewpoint->yaw ||
osys->viewpoint.pitch != p_viewpoint->pitch ||
- osys->viewpoint.roll != p_viewpoint->roll) {
+ osys->viewpoint.roll != p_viewpoint->roll ||
+ osys->viewpoint.zoom != p_viewpoint->zoom ||
+ osys->viewpoint.fov != p_viewpoint->fov) {
osys->viewpoint = *p_viewpoint;
osys->ch_viewpoint = true;
@@ -1239,10 +1241,14 @@ void vout_UpdateDisplayViewpoint(vout_display_t *vd,
} else {
if (0 != p_viewpoint->yaw ||
0 != p_viewpoint->pitch ||
- 0 != p_viewpoint->roll) {
+ 0 != p_viewpoint->roll ||
+ 0 != p_viewpoint->zoom ||
+ 0 != p_viewpoint->fov) {
osys->viewpoint.yaw += p_viewpoint->yaw;
osys->viewpoint.pitch += p_viewpoint->pitch;
osys->viewpoint.roll += p_viewpoint->roll;
+ osys->viewpoint.zoom += p_viewpoint->zoom;
+ osys->viewpoint.fov += p_viewpoint->fov;
osys->ch_viewpoint = true;
}
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 1a9369d..e23aee6 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -565,6 +565,8 @@ static void VoutGetDisplayCfg(vout_thread_t *vout, vout_display_cfg_t *cfg, cons
cfg->viewpoint.yaw = 0.0f;
cfg->viewpoint.pitch = 0.0f;
cfg->viewpoint.roll = 0.0f;
+ cfg->viewpoint.fov = 0.0f;
+ cfg->viewpoint.zoom = 0.0f;
cfg->display.title = title;
const int display_width = var_CreateGetInteger(vout, "width");
const int display_height = var_CreateGetInteger(vout, "height");
--
2.9.3
More information about the vlc-devel
mailing list