[vlc-devel] [PATCH v3 05/20] opengl: compute the picture placement when we are using it

Steve Lhomme robux4 at ycbcr.xyz
Wed Aug 26 13:55:32 CEST 2020


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

diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index 0b00ce8b42a..727b71c38a8 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,13 @@ 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_display_PlaceFlipVertical(vd->cfg, &place);
+            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 +223,6 @@ static int Control (vout_display_t *vd, int query, va_list ap)
       case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
       case VOUT_DISPLAY_CHANGE_ZOOM:
       {
-        const video_format_t *src = &vd->source;
-
-        vout_display_PlacePicture(&sys->place, src, vd->cfg);
-        vout_display_PlaceFlipVertical(vd->cfg, &sys->place);
         sys->place_changed = true;
         vlc_gl_Resize (sys->gl, vd->cfg->display.width, vd->cfg->display.height);
         return VLC_SUCCESS;
@@ -233,8 +231,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_PlacePicture(&sys->place, &vd->source, vd->cfg);
-        vout_display_PlaceFlipVertical(vd->cfg, &sys->place);
         sys->place_changed = true;
         return VLC_SUCCESS;
       }
-- 
2.26.2



More information about the vlc-devel mailing list