[vlc-devel] [PATCH 01/15] display: make vd->owner a const pointer

Steve Lhomme robux4 at ycbcr.xyz
Thu Sep 3 07:52:18 CEST 2020


No need to make it writable to modules.
The storage is now in vout_display_priv_t.display_owner.
---
 include/vlc_vout_display.h | 6 +++---
 src/video_output/display.c | 5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 96f582a609c..4c64186788d 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -375,7 +375,7 @@ struct vout_display_t {
      *
      * It must not be overwritten nor used directly by a module.
      */
-    vout_display_owner_t owner;
+    const vout_display_owner_t *owner;
 };
 
 /**
@@ -445,8 +445,8 @@ static inline void vout_display_SendEventMouseDoubleClick(vout_display_t *vd)
 static inline void vout_display_SendEventViewpointMoved(vout_display_t *vd,
                                                         const vlc_viewpoint_t *vp)
 {
-    if (vd->owner.viewpoint_moved)
-        vd->owner.viewpoint_moved(vd->owner.sys, vp);
+    if (vd->owner->viewpoint_moved)
+        vd->owner->viewpoint_moved(vd->owner->sys, vp);
 }
 
 /**
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 2d05d8e9325..58a524543ae 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -286,6 +286,7 @@ void vout_display_TranslateMouseState(vout_display_t *vd, vlc_mouse_t *video,
 
 typedef struct {
     vout_display_t  display;
+    vout_display_owner_t display_owner;
 
     /* */
     vout_display_cfg_t cfg;
@@ -730,12 +731,14 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
     osys->crop.bottom = 0;
     osys->crop.num = 0;
     osys->crop.den = 0;
+    osys->display_owner = owner ? *owner : (vout_display_owner_t) { 0 };
 
     osys->src_vctx = vctx ? vlc_video_context_Hold( vctx ) : NULL;
 
     /* */
     vout_display_t *vd = &osys->display;
     video_format_Copy(&vd->source, source);
+    vd->owner = &osys->display_owner;
     vd->info = (vout_display_info_t){ };
     vd->cfg = &osys->cfg;
     vd->prepare = NULL;
@@ -743,8 +746,6 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
     vd->control = NULL;
     vd->close = NULL;
     vd->sys = NULL;
-    if (owner)
-        vd->owner = *owner;
 
     if (vlc_module_load(vd, "vout display", module, module && *module != '\0',
                         vout_display_start, vd, &osys->cfg,
-- 
2.26.2



More information about the vlc-devel mailing list