[vlc-commits] vout/opengl: hide orientationTransformMatrix()
Thomas Guillem
git at videolan.org
Mon Dec 19 12:06:42 CET 2016
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Dec 16 17:05:51 2016 +0100| [6ddbef9b2f7be2abbabab40567850f22a7021ab1] | committer: Thomas Guillem
vout/opengl: hide orientationTransformMatrix()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6ddbef9b2f7be2abbabab40567850f22a7021ab1
---
modules/video_output/ios2.m | 70 +++++++++++++++++++++++++++++++
modules/video_output/opengl/vout_helper.c | 4 +-
modules/video_output/opengl/vout_helper.h | 2 -
3 files changed, 73 insertions(+), 3 deletions(-)
diff --git a/modules/video_output/ios2.m b/modules/video_output/ios2.m
index 09f4caf..3f89b0a 100644
--- a/modules/video_output/ios2.m
+++ b/modules/video_output/ios2.m
@@ -590,6 +590,76 @@ static void ZeroCopyDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *su
subpicture_Delete(subpicture);
}
+static void orientationTransformMatrix(GLfloat matrix[static 16],
+ video_orientation_t orientation)
+{
+ static const GLfloat identity[] = {
+ 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f
+ };
+ memcpy(matrix, identity, sizeof(identity));
+
+ const int k_cos_pi = -1;
+ const int k_cos_pi_2 = 0;
+ const int k_cos_n_pi_2 = 0;
+
+ const int k_sin_pi = 0;
+ const int k_sin_pi_2 = 1;
+ const int k_sin_n_pi_2 = -1;
+
+ bool rotate = false;
+ int cos = 0, sin = 0;
+
+ switch (orientation) {
+
+ case ORIENT_ROTATED_90:
+ cos = k_cos_pi_2;
+ sin = k_sin_pi_2;
+ rotate = true;
+ break;
+ case ORIENT_ROTATED_180:
+ cos = k_cos_pi;
+ sin = k_sin_pi;
+ rotate = true;
+ break;
+ case ORIENT_ROTATED_270:
+ cos = k_cos_n_pi_2;
+ sin = k_sin_n_pi_2;
+ rotate = true;
+ break;
+ case ORIENT_HFLIPPED:
+ matrix[0 * 4 + 0] = -1;
+ break;
+ case ORIENT_VFLIPPED:
+ matrix[1 * 4 + 1] = -1;
+ break;
+ case ORIENT_TRANSPOSED:
+ matrix[0 * 4 + 0] = 0;
+ matrix[0 * 4 + 1] = -1;
+ matrix[1 * 4 + 0] = -1;
+ matrix[1 * 4 + 1] = 0;
+ break;
+ case ORIENT_ANTI_TRANSPOSED:
+ matrix[0 * 4 + 0] = 0;
+ matrix[0 * 4 + 1] = 1;
+ matrix[1 * 4 + 0] = 1;
+ matrix[1 * 4 + 1] = 0;
+ break;
+ default:
+ break;
+ }
+
+ if (rotate) {
+
+ matrix[0 * 4 + 0] = cos;
+ matrix[0 * 4 + 1] = -sin;
+ matrix[1 * 4 + 0] = sin;
+ matrix[1 * 4 + 1] = cos;
+ }
+}
+
/*****************************************************************************
* Our UIView object
*****************************************************************************/
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index e0fa615..e010ee3 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -790,7 +790,9 @@ static void getProjectionMatrix(float sar, float fovy, GLfloat matrix[static 16]
memcpy(matrix, m, sizeof(m));
}
-void orientationTransformMatrix(GLfloat matrix[static 16], video_orientation_t orientation) {
+static void orientationTransformMatrix(GLfloat matrix[static 16],
+ video_orientation_t orientation)
+{
memcpy(matrix, identity, sizeof(identity));
const int k_cos_pi = -1;
diff --git a/modules/video_output/opengl/vout_helper.h b/modules/video_output/opengl/vout_helper.h
index 5e5fbbe..bb72699 100644
--- a/modules/video_output/opengl/vout_helper.h
+++ b/modules/video_output/opengl/vout_helper.h
@@ -76,8 +76,6 @@ static inline bool HasExtension(const char *apis, const char *api)
return false;
}
-void orientationTransformMatrix(GLfloat matrix[static 16], video_orientation_t orientation);
-
typedef struct vout_display_opengl_t vout_display_opengl_t;
vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
More information about the vlc-commits
mailing list