[vlc-commits] vlc: run autorun modules at start-up

Rémi Denis-Courmont git at videolan.org
Sun Nov 22 16:04:35 CET 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Nov 20 19:39:53 2020 +0200| [3d0587bfad85817d576d005eefe2c6914bb59e51] | committer: Rémi Denis-Courmont

vlc: run autorun modules at start-up

This invokes each and every autorun module before instantiating the
main interface.

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

 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. "



More information about the vlc-commits mailing list