[vlc-devel] [PATCH 4/4] RFC: vout: vd: handle initial place from Open().

Thomas Guillem thomas at gllm.fr
Tue Dec 10 14:50:56 CET 2019


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.
---
 modules/video_output/opengl/display.c | 4 +++-
 src/video_output/display.c            | 3 ---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index cc9989ec056..2d17d05a14a 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -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;
diff --git a/src/video_output/display.c b/src/video_output/display.c
index bc431c62eea..200fe672569 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -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
-- 
2.20.1



More information about the vlc-devel mailing list