From 3b564f5f943a0687706ff5f1b6a70288eacfd909 Mon Sep 17 00:00:00 2001 From: Julian Scheel Date: Thu, 5 Sep 2013 16:03:01 +0200 Subject: [PATCH] omxil: vout: Handle dynamic aspect changes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Handle changes of aspect ratio through the Control handler. Signed-off-by: Julian Scheel Signed-off-by: Martin Storsjö --- modules/codec/omxil/vout.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/modules/codec/omxil/vout.c b/modules/codec/omxil/vout.c index 48aa744..d0864ae 100644 --- a/modules/codec/omxil/vout.c +++ b/modules/codec/omxil/vout.c @@ -126,6 +126,22 @@ static OMX_ERRORTYPE OmxFillBufferDone(OMX_HANDLETYPE omx_handle, return OMX_ErrorNone; } +static void UpdateDisplaySize(vout_display_t *vd, vout_display_cfg_t *cfg) +{ + OMX_CONFIG_DISPLAYREGIONTYPE config_display; + OMX_INIT_STRUCTURE(config_display); + + /* OMX_DISPLAY_SET_PIXEL is broadcom specific */ + if (strcmp(vd->sys->psz_component, "OMX.broadcom.video_render")) + return; + + config_display.nPortIndex = vd->sys->port.i_port_index; + config_display.set = OMX_DISPLAY_SET_PIXEL; + config_display.pixel_x = cfg->display.width * vd->fmt.i_height; + config_display.pixel_y = cfg->display.height * vd->fmt.i_width; + OMX_SetConfig(vd->sys->omx_handle, OMX_IndexConfigDisplayRegion, &config_display); +} + static int Open(vlc_object_t *p_this) { vout_display_t *vd = (vout_display_t *)p_this; @@ -261,12 +277,7 @@ static int Open(vlc_object_t *p_this) config_display.fullscreen = OMX_TRUE; OMX_SetConfig(p_sys->omx_handle, OMX_IndexConfigDisplayRegion, &config_display); - if (vd->fmt.i_width != vd->cfg->display.width || vd->fmt.i_height != vd->cfg->display.height) { - config_display.set = OMX_DISPLAY_SET_PIXEL; - config_display.pixel_x = vd->cfg->display.width * vd->fmt.i_height; - config_display.pixel_y = vd->cfg->display.height * vd->fmt.i_width; - OMX_SetConfig(p_sys->omx_handle, OMX_IndexConfigDisplayRegion, &config_display); - } + UpdateDisplaySize(vd, vd->cfg); } @@ -444,12 +455,18 @@ static int Control(vout_display_t *vd, int query, va_list args) default: msg_Err(vd, "Unknown request in omxil vout display"); + case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT: + return VLC_SUCCESS; + case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: + { + const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *); + UpdateDisplaySize(vd, cfg); + return VLC_SUCCESS; + } case VOUT_DISPLAY_CHANGE_FULLSCREEN: case VOUT_DISPLAY_CHANGE_WINDOW_STATE: - case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: case VOUT_DISPLAY_CHANGE_ZOOM: - case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT: case VOUT_DISPLAY_CHANGE_SOURCE_CROP: case VOUT_DISPLAY_GET_OPENGL: return VLC_EGENERIC; -- 1.8.5.2