[vlc-devel] [PATCH 07/17] core: add command-line options to set the initial VR/360° viewpoint
Steve Lhomme
robux4 at videolabs.io
Mon Nov 14 15:16:16 CET 2016
---
src/libvlc-module.c | 39 +++++++++++++++++++++++++++++++++++++++
src/playlist/engine.c | 10 ++++++++++
src/playlist/playlist_internal.h | 3 +++
3 files changed, 52 insertions(+)
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 035bcd2..d574c5a 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -433,6 +433,30 @@ static const char *const ppsz_pos_descriptions[] =
"aspect, or a float value (1.25, 1.3333, etc.) expressing pixel " \
"squareness.")
+#define VIEWPOINT_YAW_TEXT N_("Viewpoint Yaw")
+#define VIEWPOINT_YAW_LONGTEXT N_( \
+ "This forces the user viewpoint yaw (horizontal shift) for the displayed " \
+ "video, in degrees." )
+
+#define VIEWPOINT_PITCH_TEXT N_("Viewpoint Pitch")
+#define VIEWPOINT_PITCH_LONGTEXT N_( \
+ "This forces the user viewpoint pitch (vertical shift) for the displayed " \
+ "video, in degrees." )
+
+#define VIEWPOINT_ROLL_TEXT N_("Viewpoint Roll")
+#define VIEWPOINT_ROLL_LONGTEXT N_( \
+ "This forces the user viewpoint roll (head tilting) for the displayed " \
+ "video, in degrees." )
+
+#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 "\
+ "degrees." )
+
+#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_( \
"Let the video scale to fit a given window or fullscreen.")
@@ -1589,6 +1613,21 @@ vlc_module_begin ()
add_string( "aspect-ratio", NULL,
ASPECT_RATIO_TEXT, ASPECT_RATIO_LONGTEXT, false )
change_safe ()
+ add_float( "viewpoint-yaw", 0.,
+ VIEWPOINT_YAW_TEXT, VIEWPOINT_YAW_LONGTEXT, false )
+ change_safe ()
+ add_float( "viewpoint-pitch", 0.,
+ VIEWPOINT_PITCH_TEXT, VIEWPOINT_PITCH_LONGTEXT, false )
+ change_safe ()
+ add_float( "viewpoint-roll", 0.,
+ VIEWPOINT_ROLL_TEXT, VIEWPOINT_ROLL_LONGTEXT, false )
+ change_safe ()
+ add_float( "viewpoint-fov", DEFAULT_FIELD_OF_VIEW_DEGREES,
+ 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 ea9896d..97bf0d0 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -478,6 +478,16 @@ static void VariablesInit( playlist_t *p_playlist )
var_Create( p_playlist, "mute", VLC_VAR_BOOL );
var_Create( p_playlist, "volume", VLC_VAR_FLOAT );
var_SetFloat( p_playlist, "volume", -1.f );
+
+ vlc_viewpoint_t *p_vp = &pl_priv(p_playlist)->viewpoint;
+ p_vp->yaw = TO_MILLI_INT(var_InheritFloat(p_playlist, "viewpoint-yaw"));
+ p_vp->pitch = TO_MILLI_INT(var_InheritFloat(p_playlist, "viewpoint-pitch"));
+ p_vp->roll = TO_MILLI_INT(var_InheritFloat(p_playlist, "viewpoint-roll"));
+ p_vp->fov = TO_MILLI_INT(var_InheritFloat(p_playlist, "viewpoint-fov"));
+ p_vp->zoom = TO_MILLI_INT(var_InheritFloat(p_playlist, "viewpoint-zoom"));
+
+ var_Create( p_playlist, "viewpoint", VLC_VAR_ADDRESS );
+ var_SetAddress( p_playlist, "viewpoint", p_vp );
}
playlist_item_t * playlist_CurrentPlayingItem( playlist_t * p_playlist )
diff --git a/src/playlist/playlist_internal.h b/src/playlist/playlist_internal.h
index d655dc3..faa7a14 100644
--- a/src/playlist/playlist_internal.h
+++ b/src/playlist/playlist_internal.h
@@ -35,6 +35,7 @@
*/
#include "input/input_interface.h"
+#include "vlc_vout.h"
#include <assert.h>
#include "art.h"
@@ -87,6 +88,8 @@ typedef struct playlist_private_t
bool b_tree; /**< Display as a tree */
bool b_preparse; /**< Preparse items */
+
+ vlc_viewpoint_t viewpoint; /**< playback viewpoint */
} playlist_private_t;
#define pl_priv( pl ) ((playlist_private_t *)(pl))
--
2.10.1
More information about the vlc-devel
mailing list