[vlc-commits] display: move out vout thread event handler

Rémi Denis-Courmont git at videolan.org
Wed Jan 2 17:54:37 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jan  2 12:35:36 2019 +0200| [d9ef1111419e9f9bdb5d48cc8adbbc8927c0eff9] | committer: Rémi Denis-Courmont

display: move out vout thread event handler

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

 src/video_output/display.c      | 28 +++-------------------------
 src/video_output/vout_wrapper.c | 23 ++++++++++++++++++++++-
 src/video_output/vout_wrapper.h |  3 ++-
 3 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index bbd7258c13..d7cc88d26d 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -381,22 +381,6 @@ void vout_display_SendEventPicturesInvalid(vout_display_t *vd)
     atomic_store_explicit(&osys->reset_pictures, true, memory_order_release);
 }
 
-static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
-{
-    vout_thread_t *vout = vd->owner.sys;
-
-    switch (event) {
-    case VOUT_DISPLAY_EVENT_VIEWPOINT_MOVED:
-        var_SetAddress(vout, "viewpoint-moved",
-                       (void *)va_arg(args, const vlc_viewpoint_t *));
-        break;
-    default:
-        msg_Err(vd, "VoutDisplayEvent received event %d", event);
-        /* TODO add an assert when all event are handled */
-        break;
-    }
-}
-
 static void VoutDisplayCropRatio(int *left, int *top, int *right, int *bottom,
                                  const video_format_t *source,
                                  unsigned num, unsigned den)
@@ -793,9 +777,6 @@ static vout_display_t *DisplayNew(vout_thread_t *vout,
         video_format_Clean(&vd->fmt);
         goto error;
     }
-
-    var_SetBool(vout, "viewpoint-changeable",
-                vd->fmt.projection_mode != PROJECTION_MODE_RECTANGULAR);
     return vd;
 error:
     video_format_Clean(&vd->source);
@@ -831,13 +812,10 @@ void vout_DeleteDisplay(vout_display_t *vd, vout_display_cfg_t *cfg)
 vout_display_t *vout_NewDisplay(vout_thread_t *vout,
                                 const video_format_t *source,
                                 const vout_display_cfg_t *cfg,
-                                const char *module)
+                                const char *module,
+                                const vout_display_owner_t *owner)
 {
-    vout_display_owner_t owner = {
-        .event = VoutDisplayEvent, .sys = vout,
-    };
-
-    return DisplayNew(vout, source, cfg, module, false, &owner);
+    return DisplayNew(vout, source, cfg, module, false, owner);
 }
 
 /*****************************************************************************
diff --git a/src/video_output/vout_wrapper.c b/src/video_output/vout_wrapper.c
index eb9ea2e6a0..2de310189a 100644
--- a/src/video_output/vout_wrapper.c
+++ b/src/video_output/vout_wrapper.c
@@ -43,6 +43,22 @@ static int  Forward(vlc_object_t *, char const *,
                     vlc_value_t, vlc_value_t, void *);
 #endif
 
+static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
+{
+    vout_thread_t *vout = vd->owner.sys;
+
+    switch (event) {
+    case VOUT_DISPLAY_EVENT_VIEWPOINT_MOVED:
+        var_SetAddress(vout, "viewpoint-moved",
+                       (void *)va_arg(args, const vlc_viewpoint_t *));
+        break;
+    default:
+        msg_Err(vd, "VoutDisplayEvent received event %d", event);
+        /* TODO add an assert when all event are handled */
+        break;
+    }
+}
+
 /* Minimum number of display picture */
 #define DISPLAY_PICTURE_COUNT (1)
 
@@ -54,6 +70,9 @@ int vout_OpenWrapper(vout_thread_t *vout,
 {
     vout_thread_sys_t *sys = vout->p;
     vout_display_t *vd;
+    vout_display_owner_t owner = {
+        .event = VoutDisplayEvent, .sys = vout,
+    };
 
     msg_Dbg(vout, "Opening vout display wrapper");
 
@@ -63,7 +82,7 @@ int vout_OpenWrapper(vout_thread_t *vout,
     if (splitter_name)
         vd = vout_NewSplitter(vout, &vout->p->original, cfg, modlist, splitter_name);
     else
-        vd = vout_NewDisplay(vout, &vout->p->original, cfg, modlist);
+        vd = vout_NewDisplay(vout, &vout->p->original, cfg, modlist, &owner);
     free(modlist);
 
     if (vd == NULL)
@@ -128,6 +147,8 @@ int vout_OpenWrapper(vout_thread_t *vout,
     var_Create(vout, "video-wallpaper", VLC_VAR_BOOL|VLC_VAR_DOINHERIT);
     var_AddCallback(vout, "video-wallpaper", Forward, NULL);
 #endif
+    var_SetBool(VLC_OBJECT(vout), "viewpoint-changeable",
+        vout->p->display->fmt.projection_mode != PROJECTION_MODE_RECTANGULAR);
     return VLC_SUCCESS;
 
 error:
diff --git a/src/video_output/vout_wrapper.h b/src/video_output/vout_wrapper.h
index 2d565329b3..9978e7a3d4 100644
--- a/src/video_output/vout_wrapper.h
+++ b/src/video_output/vout_wrapper.h
@@ -34,7 +34,8 @@ picture_pool_t *vout_GetPool(vout_display_t *vd, unsigned count);
  * It creates a vout managed display.
  */
 vout_display_t *vout_NewDisplay( vout_thread_t *, const video_format_t *,
-    const vout_display_cfg_t *, const char *module);
+    const vout_display_cfg_t *, const char *module,
+    const vout_display_owner_t *);
 /**
  * It destroy a vout managed display.
  */



More information about the vlc-commits mailing list