[vlc-devel] [PATCH v2 2/2] omxil: Passthrough aspect ratio from input format.

Julian Scheel julian at jusst.de
Fri Sep 27 14:32:40 CEST 2013


If the input format has a valid pixel aspect ratio set (ie from the
packetizer) pass this into the output format. This helps for omx
implementations which do not report the aspect ratio.
For omx implementations which provide aspect ratio information give these
precedence over the incoming values.

Signed-off-by: Julian Scheel <julian at jusst.de>
---
 modules/codec/omxil/omxil.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index da86e23..53f4f76 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -1245,6 +1245,21 @@ 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).
+     * The broadcom OMX implementation has a vendor-specific extension for
+     * retrieving aspect ratio directly from the decoder, which we use.
+     * We prefer that one over the packetizer information. All others will
+     * just pass through the incoming aspect ratio information. */
+    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 == 0 ||
+             p_dec->fmt_out.video.i_sar_den == 0 ||
+             strncmp(p_sys->psz_component, "OMX.broadcom.", 13)))
+    {
+        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;
+    }
+
     /* Take care of decoded frames first */
     while(!p_pic)
     {
-- 
1.8.4




More information about the vlc-devel mailing list