[vlc-devel] [PATCH 4/4] vgl: add option to inhibit 360 and stereo projection
Pierre Lamot
pierre at videolabs.io
Tue Jul 3 14:38:37 CEST 2018
---
include/vlc_opengl.h | 1 +
modules/video_output/opengl/vout_helper.c | 23 ++++++++++++++++++-----
modules/video_output/vgl.c | 9 +++++++++
3 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/include/vlc_opengl.h b/include/vlc_opengl.h
index f9329c7675..618bbcd56e 100644
--- a/include/vlc_opengl.h
+++ b/include/vlc_opengl.h
@@ -82,6 +82,7 @@ struct vlc_gl_t
void (*destroyCb)(void *p_opaque);
void (*renderCb)(void *p_opaque, bool enter);
void *p_opaque;
+ bool b_force_no_projection;
} vgl;
};
};
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index 3b8d599777..75832fc830 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -271,8 +271,10 @@ static void getViewpointMatrixes(vout_display_opengl_t *vgl,
video_projection_mode_t projection_mode,
struct prgm *prgm)
{
- if (projection_mode == PROJECTION_MODE_EQUIRECTANGULAR
- || projection_mode == PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD)
+ if ( !(vgl->gl->ext == VLC_GL_EXT_VGL && vgl->gl->vgl.b_force_no_projection)
+ && (projection_mode == PROJECTION_MODE_EQUIRECTANGULAR
+ || projection_mode == PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD
+ ))
{
getProjectionMatrix(vgl->f_sar, vgl->f_fovy, prgm->var.ProjectionMatrix);
getYRotMatrix(vgl->f_teta, prgm->var.YRotMatrix);
@@ -967,7 +969,8 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
vgl->pool = NULL;
if (vgl->fmt.projection_mode != PROJECTION_MODE_RECTANGULAR
- && vout_display_opengl_SetViewpoint(vgl, viewpoint) != VLC_SUCCESS)
+ && !(vgl->gl->ext == VLC_GL_EXT_VGL && vgl->gl->vgl.b_force_no_projection)
+ && (vout_display_opengl_SetViewpoint(vgl, viewpoint) != VLC_SUCCESS) )
{
vout_display_opengl_Delete(vgl);
return NULL;
@@ -1523,7 +1526,12 @@ static int SetupCoords(vout_display_opengl_t *vgl,
unsigned nbVertices, nbIndices;
int i_ret;
- switch (vgl->fmt.projection_mode)
+ video_projection_mode_t projection_mode =
+ (vgl->gl->ext == VLC_GL_EXT_VGL && vgl->gl->vgl.b_force_no_projection)
+ ? PROJECTION_MODE_RECTANGULAR
+ : vgl->fmt.projection_mode;
+
+ switch (projection_mode)
{
case PROJECTION_MODE_RECTANGULAR:
i_ret = BuildRectangle(vgl->prgm->tc->tex_count,
@@ -1642,7 +1650,12 @@ static void TextureCropForStereo(vout_display_opengl_t *vgl,
float stereoCoefs[2];
float stereoOffsets[2];
- switch (vgl->fmt.multiview_mode)
+ video_multiview_mode_t multiview_mode =
+ (vgl->gl->ext == VLC_GL_EXT_VGL && vgl->gl->vgl.b_force_no_projection)
+ ? MULTIVIEW_2D
+ : vgl->fmt.multiview_mode;
+
+ switch (multiview_mode)
{
case MULTIVIEW_STEREO_TB:
// Display only the left eye.
diff --git a/modules/video_output/vgl.c b/modules/video_output/vgl.c
index 7296ec50cb..4d1e996b01 100644
--- a/modules/video_output/vgl.c
+++ b/modules/video_output/vgl.c
@@ -34,6 +34,10 @@
static int Open(vlc_object_t *);
static void Close(vlc_object_t *);
+#define FORCE_NO_PROJ_TEXT N_("Disable 360 and stereo projection")
+#define FORCE_NO_PROJ_LONGTEXT N_("Disable 360 and stereo projection")
+
+
vlc_module_begin()
set_shortname(N_("GL texture"))
set_description(N_("GL texture output"))
@@ -43,11 +47,13 @@ vlc_module_begin()
set_capability("opengl", 0)
set_callbacks(Open, Close)
add_shortcut("vglmem")
+ add_bool("vgl-force-no-projection", false, FORCE_NO_PROJ_TEXT, FORCE_NO_PROJ_LONGTEXT, false)
add_submodule ()
set_capability ("opengl es2", 0)
set_callbacks (Open, Close)
add_shortcut ("vglmem")
+ add_bool("vgl-force-no-projection", false, FORCE_NO_PROJ_TEXT, FORCE_NO_PROJ_LONGTEXT, false)
vlc_module_end()
/*****************************************************************************
@@ -103,6 +109,9 @@ static int Open(vlc_object_t *object)
gl->resize = NULL;
gl->swap = SwapBuffers;
gl->getProcAddress = OurGetProcAddress;
+
+ gl->vgl.b_force_no_projection = var_InheritBool(gl, "vgl-force-no-projection");
+
return VLC_SUCCESS;
error:
--
2.17.1
More information about the vlc-devel
mailing list