[vlc-devel] [PATCH] mediacodec: add rotation support for opaque

Thomas Guillem thomas at gllm.fr
Wed Dec 3 17:27:57 CET 2014


---
 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.
-- 
2.1.3




More information about the vlc-devel mailing list