Commit 3b564f5f authored by Julian Scheel's avatar Julian Scheel Committed by Martin Storsjö

omxil: vout: Handle dynamic aspect changes.

Handle changes of aspect ratio through the Control handler.
Signed-off-by: default avatarJulian Scheel <julian@jusst.de>
Signed-off-by: default avatarMartin Storsjö <martin@martin.st>
parent d73a0896
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment