[vlc-commits] vout/opengl: android: fix not normal orientation

Thomas Guillem git at videolan.org
Mon Dec 19 17:24:43 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Dec 19 16:54:27 2016 +0100| [2c51d8b5144f6ed99a3feb040b0d694f2084c119] | committer: Thomas Guillem

vout/opengl: android: fix not normal orientation

This was working before since vd->fmt.orientation was ignored for
MediaCodec.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2c51d8b5144f6ed99a3feb040b0d694f2084c119
---

 modules/video_output/opengl/converter_android.c | 32 ++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/opengl/converter_android.c b/modules/video_output/opengl/converter_android.c
index 255c60b..8f0b48d 100644
--- a/modules/video_output/opengl/converter_android.c
+++ b/modules/video_output/opengl/converter_android.c
@@ -232,7 +232,37 @@ opengl_tex_converter_anop_init(const video_format_t *fmt,
     tc->chroma       = VLC_CODEC_ANDROID_OPAQUE;
     tc->desc         = &desc;
     tc->tex_target   = GL_TEXTURE_EXTERNAL_OES;
-    tc->orientation  = ORIENT_VFLIPPED;
+
+    /* The transform Matrix (uSTMatrix) given by the SurfaceTexture is not
+     * using the same origin than us. Ask the caller to rotate textures
+     * coordinates, via the vertex shader, by forcing an orientation. */
+    switch (tc->orientation)
+    {
+        case ORIENT_TOP_LEFT:
+            tc->orientation = ORIENT_BOTTOM_LEFT;
+            break;
+        case ORIENT_TOP_RIGHT:
+            tc->orientation = ORIENT_BOTTOM_RIGHT;
+            break;
+        case ORIENT_BOTTOM_LEFT:
+            tc->orientation = ORIENT_TOP_LEFT;
+            break;
+        case ORIENT_BOTTOM_RIGHT:
+            tc->orientation = ORIENT_TOP_RIGHT;
+            break;
+        case ORIENT_LEFT_TOP:
+            tc->orientation = ORIENT_RIGHT_TOP;
+            break;
+        case ORIENT_LEFT_BOTTOM:
+            tc->orientation = ORIENT_RIGHT_BOTTOM;
+            break;
+        case ORIENT_RIGHT_TOP:
+            tc->orientation = ORIENT_LEFT_TOP;
+            break;
+        case ORIENT_RIGHT_BOTTOM:
+            tc->orientation = ORIENT_LEFT_BOTTOM;
+            break;
+    }
 
     static const char *code =
         "#version " GLSL_VERSION "\n"



More information about the vlc-commits mailing list