[vlc-devel] [PATCH] display: only pass the vout_display_priv_t to vout_display_start()

Steve Lhomme robux4 at ycbcr.xyz
Thu Aug 27 08:23:06 CEST 2020


All the fields we use in this function comes from this structure.
---
 src/video_output/display.c | 44 ++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index 0112425ac14..f59f2066322 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -76,27 +76,6 @@ static int vout_display_Control(vout_display_t *vd, int query, ...)
  *
  *****************************************************************************/
 
-static int vout_display_start(void *func, bool forced, va_list ap)
-{
-    vout_display_open_cb activate = func;
-    vout_display_t *vd = va_arg(ap, vout_display_t *);
-    const vout_display_cfg_t *cfg = va_arg(ap, const vout_display_cfg_t *);
-    vlc_video_context *context = va_arg(ap, vlc_video_context *);
-
-    /* Picture buffer does not have the concept of aspect ratio */
-    video_format_Copy(&vd->fmt, &vd->source);
-    vd->fmt.i_sar_num = 0;
-    vd->fmt.i_sar_den = 0;
-    vd->obj.force = forced; /* TODO: pass to activate() instead? */
-
-    int ret = activate(vd, cfg, &vd->fmt, context);
-    if (ret != VLC_SUCCESS) {
-        video_format_Clean(&vd->fmt);
-        vlc_objres_clear(VLC_OBJECT(vd));
-    }
-    return ret;
-}
-
 /* */
 void vout_display_GetDefaultDisplaySize(unsigned *width, unsigned *height,
                                         const video_format_t *source,
@@ -311,6 +290,26 @@ typedef struct {
     picture_pool_t *pool;
 } vout_display_priv_t;
 
+static int vout_display_start(void *func, bool forced, va_list ap)
+{
+    vout_display_open_cb activate = func;
+    vout_display_priv_t *osys = va_arg(ap, vout_display_priv_t *);
+    vout_display_t *vd = &osys->display;
+
+    /* Picture buffer does not have the concept of aspect ratio */
+    video_format_Copy(&vd->fmt, &vd->source);
+    vd->fmt.i_sar_num = 0;
+    vd->fmt.i_sar_den = 0;
+    vd->obj.force = forced; /* TODO: pass to activate() instead? */
+
+    int ret = activate(vd, &osys->cfg, &vd->fmt, osys->src_vctx);
+    if (ret != VLC_SUCCESS) {
+        video_format_Clean(&vd->fmt);
+        vlc_objres_clear(VLC_OBJECT(vd));
+    }
+    return ret;
+}
+
 static vlc_decoder_device * DisplayHoldDecoderDevice(vlc_object_t *o, void *sys)
 {
     VLC_UNUSED(o);
@@ -785,8 +784,7 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
         vd->owner = *owner;
 
     if (vlc_module_load(vd, "vout display", module, module && *module != '\0',
-                        vout_display_start, vd, &osys->cfg,
-                        osys->src_vctx) == NULL)
+                        vout_display_start, osys) == NULL)
         goto error;
 
 #if defined(__OS2__)
-- 
2.26.2



More information about the vlc-devel mailing list