[vlc-commits] vout: use vd->cfg with VOUT_DISPLAY_CHANGE_xxx controls

Steve Lhomme git at videolan.org
Mon Sep 7 08:17:03 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Sep  2 10:28:18 2020 +0200| [96076938e287461b5f5794443e007e8c41e70afa] | committer: Steve Lhomme

vout: use vd->cfg with VOUT_DISPLAY_CHANGE_xxx controls

The passed pointer is always vd->cfg. No need to go through varargs for that.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=96076938e287461b5f5794443e007e8c41e70afa
---

 modules/hw/mmal/vout.c                 |  3 +--
 modules/hw/vdpau/display.c             |  3 +--
 modules/video_output/android/display.c |  6 ++----
 modules/video_output/caopengllayer.m   |  5 +----
 modules/video_output/ios.m             |  7 ++-----
 modules/video_output/kva.c             |  6 ++----
 modules/video_output/macosx.m          |  7 ++-----
 modules/video_output/opengl/display.c  |  4 ++--
 modules/video_output/vulkan/display.c  |  3 +--
 modules/video_output/wayland/shm.c     |  7 +++----
 modules/video_output/win32/common.c    | 10 +++++-----
 modules/video_output/xcb/render.c      |  7 ++-----
 modules/video_output/xcb/x11.c         |  3 +--
 13 files changed, 25 insertions(+), 46 deletions(-)

diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index d96328fc63..e06a24a5da 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -702,8 +702,7 @@ static int vd_control(vout_display_t *vd, int query, va_list args)
     switch (query) {
         case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
         {
-            const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *);
-            if (configure_display(vd, cfg, NULL) >= 0)
+            if (configure_display(vd, vd->cfg, NULL) >= 0)
                 ret = VLC_SUCCESS;
             break;
         }
diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index f6bc61d819..552411e2e6 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -255,10 +255,9 @@ static int Control(vout_display_t *vd, int query, va_list ap)
     }
     case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
     {
-        const vout_display_cfg_t *cfg = va_arg(ap, const vout_display_cfg_t *);
         vout_display_place_t place;
 
-        vout_display_PlacePicture(&place, vd->source, cfg);
+        vout_display_PlacePicture(&place, vd->source, vd->cfg);
         if (place.width  != vd->fmt->i_visible_width
          || place.height != vd->fmt->i_visible_height)
             return VLC_EGENERIC;
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index 297ac18c2f..2024122c05 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -916,10 +916,8 @@ static int Control(vout_display_t *vd, int query, va_list args)
     }
     case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
     {
-        const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *);
-
-        sys->i_display_width = cfg->display.width;
-        sys->i_display_height = cfg->display.height;
+        sys->i_display_width = vd->cfg->display.width;
+        sys->i_display_height = vd->cfg->display.height;
         msg_Dbg(vd, "change display size: %dx%d", sys->i_display_width,
                                                   sys->i_display_height);
         FixSubtitleFormat(sys);
diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
index 8b76c0b6d1..dd4d9ae062 100644
--- a/modules/video_output/caopengllayer.m
+++ b/modules/video_output/caopengllayer.m
@@ -308,11 +308,8 @@ static int Control (vout_display_t *vd, int query, va_list ap)
         case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
         case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
         {
-            const vout_display_cfg_t *cfg =
-                va_arg (ap, const vout_display_cfg_t *);
-
             /* we always use our current frame here */
-            vout_display_cfg_t cfg_tmp = *cfg;
+            vout_display_cfg_t cfg_tmp = *vd->cfg;
             [CATransaction lock];
             CGRect bounds = [sys->cgLayer visibleRect];
             [CATransaction unlock];
diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
index 9ba5dd4246..9bfb145a84 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -261,12 +261,9 @@ static int Control(vout_display_t *vd, int query, va_list ap)
         case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
         case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
         {
-            const vout_display_cfg_t *cfg =
-                va_arg(ap, const vout_display_cfg_t *);
+            assert(vd->cfg);
 
-            assert(cfg);
-
-            [sys->glESView updateVoutCfg:cfg withVGL:glsys->vgl];
+            [sys->glESView updateVoutCfg:vd->cfg withVGL:glsys->vgl];
 
             return VLC_SUCCESS;
         }
diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
index fb7d289e20..8a07fa65c1 100644
--- a/modules/video_output/kva.c
+++ b/modules/video_output/kva.c
@@ -420,11 +420,9 @@ static int Control( vout_display_t *vd, int query, va_list args )
 
     case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
     {
-        const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *);
-
         WinPostMsg( sys->client, WM_VLC_SIZE_CHANGE,
-                    MPFROMLONG( cfg->display.width ),
-                    MPFROMLONG( cfg->display.height ));
+                    MPFROMLONG( vd->cfg->display.width ),
+                    MPFROMLONG( vd->cfg->display.height ));
         return VLC_SUCCESS;
     }
 
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index b4d0921eae..77d8222c23 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -350,12 +350,9 @@ static int Control (vout_display_t *vd, int query, va_list ap)
             case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
             case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
             {
-                const vout_display_cfg_t *cfg =
-                    va_arg (ap, const vout_display_cfg_t *);
-
                 /* we always use our current frame here, because we have some size constraints
                  in the ui vout provider */
-                vout_display_cfg_t cfg_tmp = *cfg;
+                vout_display_cfg_t cfg_tmp = *vd->cfg;
 
                 /* Reverse vertical alignment as the GL tex are Y inverted */
                 if (cfg_tmp.align.vertical == VLC_VIDEO_ALIGN_TOP)
@@ -366,7 +363,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
                 vout_display_place_t place;
                 vout_display_PlacePicture(&place, vd->source, &cfg_tmp);
                 @synchronized (sys->glView) {
-                    sys->cfg = *cfg;
+                    sys->cfg = *vd->cfg;
                 }
 
                 if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index 464be2cebf..e8f073c3ba 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -231,7 +231,7 @@ 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 = *va_arg(ap, const vout_display_cfg_t *);
+        vout_display_cfg_t cfg = *vd->cfg;
 
         FlipVerticalAlign(&cfg);
 
@@ -244,7 +244,7 @@ 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 = *va_arg(ap, const vout_display_cfg_t *);
+        vout_display_cfg_t cfg = *vd->cfg;
 
         FlipVerticalAlign(&cfg);
 
diff --git a/modules/video_output/vulkan/display.c b/modules/video_output/vulkan/display.c
index 56825b325e..1d58b3a476 100644
--- a/modules/video_output/vulkan/display.c
+++ b/modules/video_output/vulkan/display.c
@@ -347,8 +347,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
     case VOUT_DISPLAY_CHANGE_ZOOM: {
-        vout_display_cfg_t cfg = *va_arg (ap, const vout_display_cfg_t *);
-        vout_display_PlacePicture(&sys->place, vd->source, &cfg);
+        vout_display_PlacePicture(&sys->place, vd->source, vd->cfg);
         return VLC_SUCCESS;
     }
 
diff --git a/modules/video_output/wayland/shm.c b/modules/video_output/wayland/shm.c
index 5c1118f62b..27b26955cb 100644
--- a/modules/video_output/wayland/shm.c
+++ b/modules/video_output/wayland/shm.c
@@ -187,9 +187,8 @@ static int Control(vout_display_t *vd, int query, va_list ap)
         case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
         case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
         {
-            const vout_display_cfg_t *cfg = va_arg(ap, const vout_display_cfg_t *);
-            sys->display_width = cfg->display.width;
-            sys->display_height = cfg->display.height;
+            sys->display_width = vd->cfg->display.width;
+            sys->display_height = vd->cfg->display.height;
 
             if (sys->viewport != NULL)
             {
@@ -197,7 +196,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
                 vout_display_place_t place;
 
                 video_format_ApplyRotation(&fmt, vd->source);
-                vout_display_PlacePicture(&place, vd->source, cfg);
+                vout_display_PlacePicture(&place, vd->source, vd->cfg);
 
                 wp_viewport_set_source(sys->viewport,
                                 wl_fixed_from_int(fmt.i_x_offset),
diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index b8454793c2..88c1fc4a9a 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -132,17 +132,17 @@ void CommonWindowClean(vout_display_sys_win32_t *sys)
 int CommonControl(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_win32_t *sys, int query, va_list args)
 {
     switch (query) {
-    case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: /* const vout_display_cfg_t *p_cfg */
-    case VOUT_DISPLAY_CHANGE_ZOOM:           /* const vout_display_cfg_t *p_cfg */
+    case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
+    case VOUT_DISPLAY_CHANGE_ZOOM:
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP: {
-        area->vdcfg = *va_arg(args, const vout_display_cfg_t *);
+        area->vdcfg = *vd->cfg;
         CommonPlacePicture(vd, area, sys);
         return VLC_SUCCESS;
     }
-    case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:   /* const vout_display_cfg_t *p_cfg */
+    case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
     {   /* Update dimensions */
-        area->vdcfg = *va_arg(args, const vout_display_cfg_t *);
+        area->vdcfg = *vd->cfg;
 #if !VLC_WINSTORE_APP
         if (sys->event != NULL)
         {
diff --git a/modules/video_output/xcb/render.c b/modules/video_output/xcb/render.c
index 16197f65db..14eaa06c3d 100644
--- a/modules/video_output/xcb/render.c
+++ b/modules/video_output/xcb/render.c
@@ -360,18 +360,15 @@ static int Control(vout_display_t *vd, int query, va_list ap)
         case VOUT_DISPLAY_CHANGE_ZOOM:
         case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
         case VOUT_DISPLAY_CHANGE_SOURCE_CROP: {
-            const vout_display_cfg_t *cfg = va_arg(ap,
-                                                   const vout_display_cfg_t *);
-
             /* Update the window size */
             uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
             const uint32_t values[] = {
-                cfg->display.width, cfg->display.height
+                vd->cfg->display.width, vd->cfg->display.height
             };
 
             xcb_configure_window(sys->conn, sys->drawable.dest, mask, values);
             DeleteBuffers(vd);
-            CreateBuffers(vd, cfg);
+            CreateBuffers(vd, vd->cfg);
             xcb_flush(sys->conn);
             return VLC_SUCCESS;
         }
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index 4e57eea987..eee5c66651 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -145,12 +145,11 @@ static int Control(vout_display_t *vd, int query, va_list ap)
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
     {
-        const vout_display_cfg_t *cfg = va_arg(ap, const vout_display_cfg_t *);
         video_format_t src, *fmt = &sys->fmt;
         vout_display_place_t place;
         int ret = VLC_SUCCESS;
 
-        vout_display_PlacePicture(&place, vd->source, cfg);
+        vout_display_PlacePicture(&place, vd->source, vd->cfg);
 
         uint32_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y;
         const uint32_t values[] = {



More information about the vlc-commits mailing list