[vlc-devel] [PATCH 4/4] mediacodec: Use the input aspect ratio when sizing the direct rendering surface

Martin Storsjö martin at martin.st
Thu Feb 6 14:05:11 CET 2014


---
 modules/codec/omxil/android_mediacodec.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index c36bdc9..e7109d2 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -619,9 +619,14 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic)
             int crop_bottom     = GET_INTEGER(format, "crop-bottom");
 
             const char *name = "unknown";
-            if (p_sys->direct_rendering)
-                jni_SetAndroidSurfaceSizeEnv(env, width, height, width, height, 1, 1);
-            else
+            if (p_sys->direct_rendering) {
+                int sar_num = 1, sar_den = 1;
+                if (p_dec->fmt_in.video.i_sar_num != 0 && p_dec->fmt_in.video.i_sar_den != 0) {
+                    sar_num = p_dec->fmt_in.video.i_sar_num;
+                    sar_den = p_dec->fmt_in.video.i_sar_den;
+                }
+                jni_SetAndroidSurfaceSizeEnv(env, width, height, width, height, sar_num, sar_den);
+            } else
                 GetVlcChromaFormat(p_sys->pixel_format, &p_dec->fmt_out.i_codec, &name);
 
             msg_Dbg(p_dec, "output: %d %s, %dx%d stride %d %d, crop %d %d %d %d",
-- 
1.8.3.4 (Apple Git-47)




More information about the vlc-devel mailing list