[vlc-devel] [PATCH 1/5] vlc: run autorun modules at start-up

remi at remlab.net remi at remlab.net
Fri Nov 20 19:09:48 CET 2020


From: RĂ©mi Denis-Courmont <remi at remlab.net>

This invokes each and every autorun module before instantiating the
main interface.
---
 src/interface/interface.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/interface/interface.c b/src/interface/interface.c
index cc490a35f2..37ecf0e6d9 100644
--- a/src/interface/interface.c
+++ b/src/interface/interface.c
@@ -240,6 +240,22 @@ void libvlc_InternalPlay(libvlc_int_t *libvlc)
     vlc_playlist_Unlock(playlist);
 }
 
+static void libvlc_AutoRun(libvlc_int_t *libvlc)
+{
+    struct vlc_logger *log = libvlc->obj.logger;
+    module_t **mods;
+    ssize_t total = vlc_module_match("autorun", NULL, false, &mods, NULL);
+
+    for (ssize_t i = 0; i < total; i++) {
+        void (*func)(libvlc_int_t *) = vlc_module_map(log, mods[i]);
+
+        assert(func != NULL);
+        func(libvlc);
+    }
+
+    free(mods);
+}
+
 /**
  * Starts an interface plugin.
  */
@@ -251,6 +267,8 @@ int libvlc_InternalAddIntf(libvlc_int_t *libvlc, const char *name)
         ret = intf_Create(libvlc, name);
     else
     {   /* Default interface */
+        libvlc_AutoRun(libvlc);
+
         char *intf = var_InheritString(libvlc, "intf");
         if (intf == NULL) /* "intf" has not been set */
             msg_Info(libvlc, _("Running vlc with the default interface. "
-- 
2.29.2



More information about the vlc-devel mailing list