[vlc-devel] [PATCH 01/38] video_output: pass the video format to vout_SizeWindow()

Steve Lhomme robux4 at ycbcr.xyz
Tue Oct 1 13:12:24 CEST 2019


and only pass the vout_thread_sys_t instead of the unused vout.

This will be needed when the GetDevice call will create a window without setting
the sys->original which is only related to the display module.
---
 src/video_output/video_output.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index eb022fb2ac0..1e7727f9730 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -147,14 +147,15 @@ static void vout_display_SizeWindow(unsigned *restrict width,
     *height = (h * cfg->zoom.num) / cfg->zoom.den;
 }
 
-static void vout_SizeWindow(vout_thread_t *vout, unsigned *restrict width,
+static void vout_SizeWindow(vout_thread_sys_t *sys,
+                            const video_format_t *original,
+                            unsigned *restrict width,
                             unsigned *restrict height)
 {
-    vout_thread_sys_t *sys = vout->p;
-    unsigned w = sys->original.i_visible_width;
-    unsigned h = sys->original.i_visible_height;
-    unsigned sar_num = sys->original.i_sar_num;
-    unsigned sar_den = sys->original.i_sar_num;
+    unsigned w = original->i_visible_width;
+    unsigned h = original->i_visible_height;
+    unsigned sar_num = original->i_sar_num;
+    unsigned sar_den = original->i_sar_num;
 
     switch (sys->source.crop.mode) {
         case VOUT_CROP_NONE:
@@ -190,7 +191,7 @@ static void vout_SizeWindow(vout_thread_t *vout, unsigned *restrict width,
 
     /* If the vout thread is running, the window lock must be held here. */
     vout_display_SizeWindow(width, height, w, h, sar_num, sar_den,
-                            sys->original.orientation,
+                            original->orientation,
                             &sys->display_cfg);
 }
 
@@ -203,7 +204,7 @@ static void vout_UpdateWindowSizeLocked(vout_thread_t *vout)
 
     vlc_mutex_lock(&sys->display_lock);
     if (sys->display != NULL) {
-        vout_SizeWindow(vout, &width, &height);
+        vout_SizeWindow(sys, &sys->original, &width, &height);
         vlc_mutex_unlock(&sys->display_lock);
 
         msg_Dbg(vout, "requested window size: %ux%u", width, height);
@@ -1954,7 +1955,7 @@ int vout_Request(const vout_configuration_t *cfg, input_thread_t *input)
         };
 
         VoutGetDisplayCfg(vout, &original, &sys->display_cfg);
-        vout_SizeWindow(vout, &wcfg.width, &wcfg.height);
+        vout_SizeWindow(sys, &sys->original, &wcfg.width, &wcfg.height);
 
         if (vout_window_Enable(sys->display_cfg.window, &wcfg)) {
             vlc_mutex_unlock(&sys->window_lock);
-- 
2.17.1



More information about the vlc-devel mailing list