[vlc-devel] [PATCH v2 07/19] opengl: compute the picture placement when we are using it

Steve Lhomme robux4 at ycbcr.xyz
Tue Aug 25 16:20:20 CEST 2020


---
 modules/video_output/opengl/display.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index 58f0cdc388f..e3c1320960e 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -72,7 +72,6 @@ struct vout_display_sys_t
 {
     vout_display_opengl_t *vgl;
     vlc_gl_t *gl;
-    vout_display_place_t place;
     bool place_changed;
 };
 
@@ -194,10 +193,12 @@ static void PictureDisplay (vout_display_t *vd, picture_t *pic)
     {
         if (sys->place_changed)
         {
-            float window_ar = (float)sys->place.width / sys->place.height;
+            vout_display_place_t place;
+            vout_display_PlacePicture(&place, &vd->source, vd->cfg, VOUT_ORIGIN_BOTTOM_LEFT);
+            float window_ar = (float)place.width / place.height;
             vout_display_opengl_SetWindowAspectRatio(sys->vgl, window_ar);
-            vout_display_opengl_Viewport(sys->vgl, sys->place.x, sys->place.y,
-                                         sys->place.width, sys->place.height);
+            vout_display_opengl_Viewport(sys->vgl, place.x, place.y,
+                                         place.width, place.height);
             sys->place_changed = false;
         }
 
@@ -221,10 +222,6 @@ static int Control (vout_display_t *vd, int query, va_list ap)
       case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
       case VOUT_DISPLAY_CHANGE_ZOOM:
       {
-        vout_display_cfg_t cfg = *vd->cfg;
-        const video_format_t *src = &vd->source;
-
-        vout_display_PlacePicture(&sys->place, src, &cfg, VOUT_ORIGIN_BOTTOM_LEFT);
         sys->place_changed = true;
         vlc_gl_Resize (sys->gl, vd->cfg->display.width, vd->cfg->display.height);
         return VLC_SUCCESS;
@@ -233,9 +230,6 @@ static int Control (vout_display_t *vd, int query, va_list ap)
       case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
       case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
       {
-        vout_display_cfg_t cfg = *vd->cfg;
-
-        vout_display_PlacePicture(&sys->place, &vd->source, &cfg, VOUT_ORIGIN_BOTTOM_LEFT);
         sys->place_changed = true;
         return VLC_SUCCESS;
       }
-- 
2.26.2



More information about the vlc-devel mailing list