Commit cf0ea956 authored by Thomas Guillem's avatar Thomas Guillem

RFC: vout: vd: handle initial place from Open().

The following call from vout_display_New():
    vout_display_GetDefaultDisplaySize(&osys->cfg.display.width,
                                       &osys->cfg.display.height,
                                       source, &osys->cfg)
is overriding the vd cfg.display size. In that case, any future call of
vout_display_PlacePicture() will be misplaced. Indeed,
    place->x = ((int)cfg->display.width - (int)place->width) / 2;
    place->y = ((int)cfg->display.height - (int)place->height) / 2;
will be 0x0 since cfg->display.width == place->width.

This is noticeable via the gl vd on Android with --no-autoscale: the display
is not centered. After a  VOUT_DISPLAY_CHANGE_* control,
vout_display_PlacePicture() will use a correct cfg and the display will be well
placed.

The most obvious way to fix it is to remove the
vout_display_GetDefaultDisplaySize() call from vout_display_New() and let all
vd plugins handle their initial placement, like it's done in this commit.

This commit is temporary and will be split if accepted. Other vd modules
need to be fixed in that case.
parent 32b8a2f7
......@@ -95,7 +95,6 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
sys->gl = NULL;
sys->pool = NULL;
sys->place_changed = false;
vout_window_t *surface = cfg->window;
char *gl_name = var_InheritString(surface, MODULE_VARNAME);
......@@ -144,6 +143,9 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
if (sys->vgl == NULL)
goto error;
vout_display_PlacePicture(&sys->place, &vd->source, cfg);
sys->place_changed = true;
vd->sys = sys;
vd->info.subpicture_chromas = spu_chromas;
vd->pool = vout_display_opengl_HasPool(sys->vgl) ? Pool : NULL;
......
......@@ -747,9 +747,6 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
return NULL;
osys->cfg = *cfg;
vout_display_GetDefaultDisplaySize(&osys->cfg.display.width,
&osys->cfg.display.height,
source, &osys->cfg);
#ifdef _WIN32
osys->reset_pictures = false;
#endif
......
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