[vlc-commits] omxil: Use OMX_IndexConfigCommonOutputCrop to set video width/height
Martin Storsjö
git at videolan.org
Wed Apr 4 15:06:07 CEST 2012
vlc | branch: master | Martin Storsjö <martin at martin.st> | Wed Apr 4 15:17:54 2012 +0300| [36300b9b389bb34971ed268c9a95bbe964a42687] | committer: Jean-Baptiste Kempf
omxil: Use OMX_IndexConfigCommonOutputCrop to set video width/height
As a side effect, this also makes the output correct on Samsung
Galaxy S II on ICS.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=36300b9b389bb34971ed268c9a95bbe964a42687
---
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. */
More information about the vlc-commits
mailing list