[vlc-devel] [PATCH 7/7] RFC: set module manually when vlc_module_load is called

Thomas Guillem thomas at gllm.fr
Mon May 27 16:45:16 CEST 2019


Cons:
 - Duplicated code
 - We should then expose vlc_object_set_module in order to let modules setup
their modules.

One other way to fix this issue is to revert
19f90e804c199bad3aa5a299e47d09bb7ad7f8ee and call vlc_object_set_module()
directly from vlc_module_load()

Fixes #21997
---
 src/input/decoder_helpers.c | 1 +
 src/input/demux.c           | 1 +
 src/video_output/display.c  | 1 +
 src/video_output/opengl.c   | 1 +
 src/video_output/window.c   | 1 +
 5 files changed, 5 insertions(+)

diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index 3d1c574cb7..0769033a63 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -141,6 +141,7 @@ vlc_decoder_device_Create(vout_window_t *window)
         vlc_object_delete(&priv->device);
         return NULL;
     }
+    vlc_object_set_module(&priv->device, priv->module);
     vlc_atomic_rc_init(&priv->rc);
     return &priv->device;
 }
diff --git a/src/input/demux.c b/src/input/demux.c
index d7b5ce3711..2547047ecc 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -253,6 +253,7 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_input,
         free( p_demux->psz_filepath );
         goto error;
     }
+    vlc_object_set_module(p_demux, priv->module);
 
     return p_demux;
 error:
diff --git a/src/video_output/display.c b/src/video_output/display.c
index f295ad6731..f285dd271f 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -777,6 +777,7 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
                                  &vd->fmt, video_context);
     if (vd->module == NULL)
         goto error;
+    vlc_object_set_module(vd, vd->module);
 
 #if defined(__OS2__)
     if ((var_GetBool(parent, "fullscreen")
diff --git a/src/video_output/opengl.c b/src/video_output/opengl.c
index f17c8ff05c..ab1f4e327f 100644
--- a/src/video_output/opengl.c
+++ b/src/video_output/opengl.c
@@ -92,6 +92,7 @@ vlc_gl_t *vlc_gl_Create(const struct vout_display_cfg *restrict cfg,
         vlc_object_delete(gl);
         return NULL;
     }
+    vlc_object_set_module(gl, gl->module);
     assert(gl->makeCurrent && gl->releaseCurrent && gl->swap
         && gl->getProcAddress);
     vlc_atomic_rc_init(&glpriv->rc);
diff --git a/src/video_output/window.c b/src/video_output/window.c
index 99a6d62454..4f18b3ac78 100644
--- a/src/video_output/window.c
+++ b/src/video_output/window.c
@@ -86,6 +86,7 @@ vout_window_t *vout_window_New(vlc_object_t *obj, const char *module,
         vlc_object_delete(window);
         return NULL;
     }
+    vlc_object_set_module(window, w->module);
 
     /* Hook for screensaver inhibition */
     if (dss > 0) {
-- 
2.20.1



More information about the vlc-devel mailing list