[vlc-commits] mediacodec: add rotation support for opaque

Thomas Guillem git at videolan.org
Wed Dec 3 17:31:06 CET 2014


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Dec  3 17:27:57 2014 +0100| [5967150642d875f12aa69ecc853e935fc593077a] | committer: Jean-Baptiste Kempf

mediacodec: add rotation support for opaque

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/codec/omxil/android_mediacodec.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index 00bea88..2d0d346 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -506,6 +506,27 @@ static int OpenDecoder(vlc_object_t *p_this)
        attached to the JNI. */
     p_sys->direct_rendering = jni_IsVideoPlayerActivityCreated() && var_InheritBool(p_dec, CFG_PREFIX "dr");
     if (p_sys->direct_rendering) {
+        if (p_dec->fmt_in.video.orientation != ORIENT_NORMAL) {
+            int i_angle;
+
+            switch (p_dec->fmt_in.video.orientation) {
+                case ORIENT_ROTATED_90:
+                    i_angle = 90;
+                    break;
+                case ORIENT_ROTATED_180:
+                    i_angle = 180;
+                    break;
+                case ORIENT_ROTATED_270:
+                    i_angle = 270;
+                    break;
+                default:
+                    i_angle = 0;
+            }
+            (*env)->CallVoidMethod(env, format, p_sys->set_integer,
+                                   (*env)->NewStringUTF(env, "rotation-degrees"),
+                                   i_angle);
+        }
+
         jobject surf = jni_LockAndGetAndroidJavaSurface();
         if (surf) {
             // Configure MediaCodec with the Android surface.



More information about the vlc-commits mailing list