1 /*****************************************************************************
2 * modules.h : Module management functions.
3 *****************************************************************************
4 * Copyright (C) 2001-2016 VLC authors and VideoLAN
7 * Authors: Samuel Hocevar <sam@zoy.org>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef LIBVLC_MODULES_H
25 # define LIBVLC_MODULES_H 1
27 # include <vlc_atomic.h>
29 /** The plugin handle type */
30 typedef void *module_handle_t
;
33 typedef struct vlc_plugin_t
35 struct vlc_plugin_t
*next
;
37 unsigned modules_count
;
39 const char *textdomain
; /**< gettext domain (or NULL) */
42 * Variables set by the module to store its config options
46 module_config_t
*items
; /**< Table of configuration parameters */
47 size_t size
; /**< Size of items table */
48 size_t count
; /**< Number of configuration items */
49 size_t booleans
; /**< Number of booleal config items */
52 #ifdef HAVE_DYNAMIC_PLUGINS
53 atomic_bool loaded
; /**< Whether the plug-in is mapped in memory */
54 bool unloadable
; /**< Whether the plug-in can be unloaded safely */
55 module_handle_t handle
; /**< Run-time linker handle (if loaded) */
56 char *abspath
; /**< Absolute path */
58 char *path
; /**< Relative path (within plug-in directory) */
59 int64_t mtime
; /**< Last modification time */
60 uint64_t size
; /**< File size */
65 * List of all plug-ins.
67 extern struct vlc_plugin_t
*vlc_plugins
;
69 #define MODULE_SHORTCUT_MAX 20
71 /** Plugin entry point prototype */
72 typedef int (*vlc_plugin_cb
) (int (*)(void *, void *, int, ...), void *);
75 int vlc_entry__core (int (*)(void *, void *, int, ...), void *);
78 * Internal module descriptor
82 vlc_plugin_t
*plugin
; /**< Plug-in/library containing the module */
85 /** Shortcuts to the module */
87 const char **pp_shortcuts
;
90 * Variables set by the module to identify itself
92 const char *psz_shortname
; /**< Module name */
93 const char *psz_longname
; /**< Module descriptive name */
94 const char *psz_help
; /**< Long help string for "special" modules */
96 const char *psz_capability
; /**< Capability */
97 int i_score
; /**< Score for the capability */
100 const char *activate_name
;
101 const char *deactivate_name
;
106 vlc_plugin_t
*vlc_plugin_create(void);
107 void vlc_plugin_destroy(vlc_plugin_t
*);
108 module_t
*vlc_module_create(vlc_plugin_t
*);
109 void vlc_module_destroy (module_t
*);
111 vlc_plugin_t
*vlc_plugin_describe(vlc_plugin_cb
);
112 int vlc_plugin_resolve(vlc_plugin_t
*, vlc_plugin_cb
);
114 void module_InitBank (void);
115 size_t module_LoadPlugins( vlc_object_t
* );
116 #define module_LoadPlugins(a) module_LoadPlugins(VLC_OBJECT(a))
117 void module_EndBank (bool);
118 int module_Map(vlc_object_t
*, vlc_plugin_t
*);
120 ssize_t
module_list_cap (module_t
***, const char *);
122 int vlc_bindtextdomain (const char *);
124 /* Low-level OS-dependent handler */
125 int module_Load (vlc_object_t
*, const char *, module_handle_t
*, bool);
126 void *module_Lookup (module_handle_t
, const char *);
127 void module_Unload (module_handle_t
);
130 vlc_plugin_t
*vlc_cache_load(vlc_object_t
*, const char *, block_t
**);
131 vlc_plugin_t
*vlc_cache_lookup(vlc_plugin_t
**, const char *relpath
);
133 void CacheSave(vlc_object_t
*, const char *, vlc_plugin_t
*const *, size_t);
135 #endif /* !LIBVLC_MODULES_H */