]> git.sesse.net Git - vlc/commitdiff
mediacodec: fix rotation before API 21
authorThomas Guillem <thomas@gllm.fr>
Thu, 12 Mar 2015 12:05:19 +0000 (13:05 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 12 Mar 2015 13:21:07 +0000 (14:21 +0100)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/codec/omxil/android_mediacodec.c

index 8a6ce90fa4392b9d36a59d379fb71f47281fd80b..7af2320edd5af8bda651487d3c21fedc89031a2d 100644 (file)
@@ -541,6 +541,17 @@ loopclean:
        direct rendering should be disabled since no surface will be
        attached to the JNI. */
     p_sys->direct_rendering = jni_IsVideoPlayerActivityCreated() && var_InheritBool(p_dec, CFG_PREFIX "dr");
+
+    /* There is no way to rotate the video using direct rendering (and using a
+     * SurfaceView) before  API 21 (Lollipop). Therefore, we deactivate direct
+     * rendering if video doesn't have a normal rotation and if
+     * get_input_buffer method is not present (This method exists since API
+     * 21). */
+    if (p_sys->direct_rendering
+        && p_dec->fmt_in.video.orientation != ORIENT_NORMAL
+        && !p_sys->get_input_buffer)
+        p_sys->direct_rendering = false;
+
     if (p_sys->direct_rendering) {
         if (p_dec->fmt_in.video.orientation != ORIENT_NORMAL) {
             int i_angle;