[vlc-commits] module: pass VLC object to vlc_module_unload()

Rémi Denis-Courmont git at videolan.org
Mon Jun 19 21:52:19 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jun 14 20:00:50 2017 +0300| [9bbea90ca0cc973d7df240c267518fe25e542aa7] | committer: Rémi Denis-Courmont

module: pass VLC object to vlc_module_unload()

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

 include/vlc_modules.h           | 5 ++++-
 modules/audio_output/mmdevice.c | 2 +-
 modules/audio_output/winstore.c | 2 +-
 modules/codec/avcodec/va.c      | 2 +-
 src/misc/messages.c             | 4 ++--
 src/modules/modules.c           | 8 +++++---
 src/network/tls.c               | 2 +-
 src/video_output/window.c       | 2 +-
 8 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/include/vlc_modules.h b/include/vlc_modules.h
index 7f45217969..2be48f0b2a 100644
--- a/include/vlc_modules.h
+++ b/include/vlc_modules.h
@@ -36,7 +36,10 @@ typedef void (*vlc_deactivate_t)(void *func, va_list args);
 VLC_API module_t * vlc_module_load( vlc_object_t *obj, const char *cap, const char *name, bool strict, vlc_activate_t probe, ... ) VLC_USED;
 #define vlc_module_load(o,c,n,s,...) \
         vlc_module_load(VLC_OBJECT(o),c,n,s,__VA_ARGS__)
-VLC_API void vlc_module_unload( module_t *, vlc_deactivate_t deinit, ... );
+VLC_API void vlc_module_unload( vlc_object_t *obj, module_t *,
+                                vlc_deactivate_t deinit, ... );
+#define vlc_module_unload(o,m,d,...) \
+        vlc_module_unload(VLC_OBJECT(o),m,d,__VA_ARGS__)
 
 VLC_API module_t * module_need( vlc_object_t *, const char *, const char *, bool ) VLC_USED;
 #define module_need(a,b,c,d) module_need(VLC_OBJECT(a),b,c,d)
diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index 42285f7184..2494eee994 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -1108,7 +1108,7 @@ static void Stop(audio_output_t *aout)
     assert(sys->stream != NULL);
 
     EnterMTA();
-    vlc_module_unload(sys->module, aout_stream_Stop, sys->stream);
+    vlc_module_unload(sys->stream, sys->module, aout_stream_Stop, sys->stream);
     LeaveMTA();
 
     vlc_object_release(sys->stream);
diff --git a/modules/audio_output/winstore.c b/modules/audio_output/winstore.c
index b3ddedd8cd..d345673249 100644
--- a/modules/audio_output/winstore.c
+++ b/modules/audio_output/winstore.c
@@ -260,7 +260,7 @@ static void Stop(audio_output_t *aout)
     assert (sys->stream != NULL);
 
     EnterMTA();
-    vlc_module_unload(sys->module, aout_stream_Stop, sys->stream);
+    vlc_module_unload(sys->stream, sys->module, aout_stream_Stop, sys->stream);
     LeaveMTA();
 
     vlc_object_release(sys->stream);
diff --git a/modules/codec/avcodec/va.c b/modules/codec/avcodec/va.c
index 99cde4541b..ea43a57536 100644
--- a/modules/codec/avcodec/va.c
+++ b/modules/codec/avcodec/va.c
@@ -148,6 +148,6 @@ vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *avctx,
 
 void vlc_va_Delete(vlc_va_t *va, void *hwctx)
 {
-    vlc_module_unload(va->module, vlc_va_Stop, va, hwctx);
+    vlc_module_unload(va, va->module, vlc_va_Stop, va, hwctx);
     vlc_object_release(va);
 }
diff --git a/src/misc/messages.c b/src/misc/messages.c
index 454ad16728..9fa840478e 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -410,7 +410,7 @@ void vlc_LogSet(libvlc_int_t *vlc, vlc_log_cb cb, void *opaque)
     vlc_rwlock_unlock(&logger->lock);
 
     if (module != NULL)
-        vlc_module_unload(module, vlc_logger_unload, sys);
+        vlc_module_unload(vlc, module, vlc_logger_unload, sys);
 
     /* Announce who we are */
     msg_Dbg (vlc, "VLC media player - %s", VERSION_MESSAGE);
@@ -427,7 +427,7 @@ void vlc_LogDeinit(libvlc_int_t *vlc)
         return;
 
     if (logger->module != NULL)
-        vlc_module_unload(logger->module, vlc_logger_unload, logger->sys);
+        vlc_module_unload(vlc, logger->module, vlc_logger_unload, logger->sys);
     else
     /* Flush early log messages (corner case: no call to vlc_LogInit()) */
     if (logger->log == vlc_vaLogEarly)
diff --git a/src/modules/modules.c b/src/modules/modules.c
index 19a3af0f71..5873eff38a 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -322,13 +322,14 @@ done:
     return module;
 }
 
-
+#undef vlc_module_unload
 /**
  * Deinstantiates a module.
  * \param module the module pointer as returned by vlc_module_load()
  * \param deinit deactivation callback
  */
-void vlc_module_unload(module_t *module, vlc_deactivate_t deinit, ...)
+void vlc_module_unload(vlc_object_t *obj, module_t *module,
+                       vlc_deactivate_t deinit, ...)
 {
     if (module->pf_deactivate != NULL)
     {
@@ -338,6 +339,7 @@ void vlc_module_unload(module_t *module, vlc_deactivate_t deinit, ...)
         deinit(module->pf_deactivate, ap);
         va_end(ap);
     }
+    (void) obj;
 }
 
 
@@ -368,7 +370,7 @@ module_t *module_need(vlc_object_t *obj, const char *cap, const char *name,
 void module_unneed(vlc_object_t *obj, module_t *module)
 {
     msg_Dbg(obj, "removing module \"%s\"", module_get_object(module));
-    vlc_module_unload(module, generic_stop, obj);
+    vlc_module_unload(obj, module, generic_stop, obj);
 }
 
 /**
diff --git a/src/network/tls.c b/src/network/tls.c
index 75758d42b2..4ebcfb319c 100644
--- a/src/network/tls.c
+++ b/src/network/tls.c
@@ -131,7 +131,7 @@ void vlc_tls_Delete (vlc_tls_creds_t *crd)
     if (crd == NULL)
         return;
 
-    vlc_module_unload (crd->module, tls_unload, crd);
+    vlc_module_unload(crd, crd->module, tls_unload, crd);
     vlc_object_release (crd);
 }
 
diff --git a/src/video_output/window.c b/src/video_output/window.c
index 01d913539e..6d76f12199 100644
--- a/src/video_output/window.c
+++ b/src/video_output/window.c
@@ -108,7 +108,7 @@ void vout_window_Delete(vout_window_t *window)
         vlc_inhibit_Destroy (w->inhibit);
     }
 
-    vlc_module_unload(w->module, vout_window_stop, window);
+    vlc_module_unload(window, w->module, vout_window_stop, window);
     vlc_object_release(window);
 }
 



More information about the vlc-commits mailing list