[vlc-devel] [PATCH 3/4] mediacodec: Pass the aspect ratio values through from the packetizer

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


There is no way in the MediaCodec API for the decoder to signal
these values to the caller, at least none that is publicly
documented.
---
 modules/codec/omxil/android_mediacodec.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index 499f1f5..c36bdc9 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -692,6 +692,15 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
         return NULL;
     }
 
+    /* Use the aspect ratio provided by the input (ie read from packetizer).
+     * Don't check the current value of the aspect ratio in fmt_out, since we
+     * want to allow changes in it to propagate. */
+    if (p_dec->fmt_in.video.i_sar_num != 0 && p_dec->fmt_in.video.i_sar_den != 0)
+    {
+        p_dec->fmt_out.video.i_sar_num = p_dec->fmt_in.video.i_sar_num;
+        p_dec->fmt_out.video.i_sar_den = p_dec->fmt_in.video.i_sar_den;
+    }
+
     jlong timeout = 0;
     const int max_polling_attempts = 50;
     int attempts = 0;
-- 
1.8.3.4 (Apple Git-47)




More information about the vlc-devel mailing list