[vlc-devel] [PATCH 3/9] omxil: Use OMX_IndexConfigCommonOutputCrop to set video width/height

Martin Storsjö martin at martin.st
Wed Apr 4 14:17:54 CEST 2012


As a side effect, this also makes the output correct on Samsung
Galaxy S II on ICS.
---
 modules/codec/omxil/omxil.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index 928fa13..fef6345 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -427,6 +427,7 @@ static OMX_ERRORTYPE GetPortDefinition(decoder_t *p_dec, OmxPort *p_port,
     decoder_sys_t *p_sys = p_dec->p_sys;
     OMX_PARAM_PORTDEFINITIONTYPE *def = &p_port->definition;
     OMX_ERRORTYPE omx_error;
+    OMX_CONFIG_RECTTYPE crop_rect;
 
     omx_error = OMX_GetParameter(p_port->omx_handle,
                                  OMX_IndexParamPortDefinition, def);
@@ -443,6 +444,22 @@ static OMX_ERRORTYPE GetPortDefinition(decoder_t *p_dec, OmxPort *p_port,
         p_fmt->video.i_frame_rate = p_dec->fmt_in.video.i_frame_rate;
         p_fmt->video.i_frame_rate_base = p_dec->fmt_in.video.i_frame_rate_base;
 
+        OMX_INIT_STRUCTURE(crop_rect);
+        crop_rect.nPortIndex = def->nPortIndex;
+        omx_error = OMX_GetConfig(p_port->omx_handle, OMX_IndexConfigCommonOutputCrop, &crop_rect);
+        if (omx_error == OMX_ErrorNone)
+        {
+            p_fmt->video.i_width = crop_rect.nWidth;
+            p_fmt->video.i_visible_width = crop_rect.nWidth;
+            p_fmt->video.i_height = crop_rect.nHeight;
+            p_fmt->video.i_visible_height = crop_rect.nHeight;
+        }
+        else
+        {
+            /* Don't pass the error back to the caller, this isn't mandatory */
+            omx_error = OMX_ErrorNone;
+        }
+
         /* Hack: Nexus One (stock firmware with binary OMX driver blob)
          * claims to output 420Planar even though it in in practice is
          * NV21. */
-- 
1.7.2.5




More information about the vlc-devel mailing list