[vlc-commits] vout: opengl: add vout_display_opengl_SetViewpoint
Steve Lhomme
git at videolan.org
Tue Nov 15 18:14:01 CET 2016
vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Thu Nov 10 10:01:34 2016 +0100| [142bedc3a93c5e153a98f50380ea4a3d3f08026b] | committer: Thomas Guillem
vout: opengl: add vout_display_opengl_SetViewpoint
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=142bedc3a93c5e153a98f50380ea4a3d3f08026b
---
modules/video_output/opengl.c | 29 ++++++++++++++++++++++++-----
modules/video_output/opengl.h | 2 ++
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c
index 16c6592..383104c 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -37,6 +37,7 @@
#include <vlc_subpicture.h>
#include <vlc_opengl.h>
#include <vlc_memory.h>
+#include <vlc_vout.h>
#include "opengl.h"
@@ -694,11 +695,12 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
if (vgl->fmt.projection_mode == PROJECTION_MODE_EQUIRECTANGULAR
|| vgl->fmt.projection_mode == PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD)
{
- vgl->f_teta = vgl->fmt.f_pose_yaw_degrees / 180. * (float) M_PI;
- vgl->f_phi = vgl->fmt.f_pose_pitch_degrees / 180. * (float) M_PI;
- vgl->f_roll = vgl->fmt.f_pose_roll_degrees / 180. * (float) M_PI;
- vgl->f_fov = vgl->fmt.f_pose_fov_degrees / 180. * (float) M_PI;
- vgl->f_teta -= (float) M_PI/2;
+ vout_display_opengl_SetViewpoint(vgl, &(vlc_viewpoint_t) {
+ .yaw = vgl->fmt.f_pose_yaw_degrees,
+ .pitch = vgl->fmt.f_pose_pitch_degrees,
+ .roll = vgl->fmt.f_pose_roll_degrees,
+ .fov = vgl->fmt.f_pose_fov_degrees,
+ .zoom = 0.f } );
}
/* */
@@ -781,6 +783,23 @@ void vout_display_opengl_Delete(vout_display_opengl_t *vgl)
free(vgl);
}
+int vout_display_opengl_SetViewpoint(vout_display_opengl_t *vgl,
+ const vlc_viewpoint_t *p_vp)
+{
+#define RAD(d) ((float) (d * M_PI / 180.f))
+ float f_fov = RAD(p_vp->fov);
+ if (f_fov > (float) M_PI -0.001f || f_fov < 0.001f)
+ return VLC_EBADVAR;
+ vgl->f_teta = RAD(p_vp->yaw) - (float) M_PI / 2;
+ vgl->f_phi = RAD(p_vp->pitch);
+ vgl->f_roll = RAD(p_vp->roll);
+ vgl->f_fov = RAD(p_vp->fov);
+ vgl->f_zoom = p_vp->zoom;
+
+ return VLC_SUCCESS;
+#undef RAD
+}
+
picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned requested_count)
{
if (vgl->pool)
diff --git a/modules/video_output/opengl.h b/modules/video_output/opengl.h
index 4ae9400..f12c55c 100644
--- a/modules/video_output/opengl.h
+++ b/modules/video_output/opengl.h
@@ -96,6 +96,8 @@ void vout_display_opengl_Delete(vout_display_opengl_t *vgl);
picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned);
+int vout_display_opengl_SetViewpoint(vout_display_opengl_t *vgl, const vlc_viewpoint_t*);
+
int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
picture_t *picture, subpicture_t *subpicture);
int vout_display_opengl_Display(vout_display_opengl_t *vgl,
More information about the vlc-commits
mailing list