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

Steve Lhomme robux4 at ycbcr.xyz
Mon Nov 23 07:57:09 CET 2020


Can we have a set_callback_autorun() to have stronger typing of the 
activate callback ?

Other than that patchset LGTM and a welcome addition.
I did not check the priority of modules match the order in which they 
were added.

On 2020-11-20 19:09, remi at remlab.net wrote:
> 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
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list