vout: ios: remove useless var creation
[vlc.git] / src / modules / modules.h
blob505629dfbde9f5b502a95cb5fb652a2acb1d6248
1 /*****************************************************************************
2 * modules.h : Module management functions.
3 *****************************************************************************
4 * Copyright (C) 2001-2016 VLC authors and VideoLAN
5 * $Id$
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 <stdatomic.h>
29 /** VLC plugin */
30 typedef struct vlc_plugin_t
32 struct vlc_plugin_t *next;
33 module_t *module;
34 unsigned modules_count;
36 const char *textdomain; /**< gettext domain (or NULL) */
38 /**
39 * Variables set by the module to store its config options
41 struct
43 module_config_t *items; /**< Table of configuration parameters */
44 size_t size; /**< Size of items table */
45 size_t count; /**< Number of configuration items */
46 size_t booleans; /**< Number of booleal config items */
47 } conf;
49 #ifdef HAVE_DYNAMIC_PLUGINS
50 atomic_bool loaded; /**< Whether the plug-in is mapped in memory */
51 bool unloadable; /**< Whether the plug-in can be unloaded safely */
52 void *handle; /**< Run-time linker handle (if loaded) */
53 char *abspath; /**< Absolute path */
55 char *path; /**< Relative path (within plug-in directory) */
56 int64_t mtime; /**< Last modification time */
57 uint64_t size; /**< File size */
58 #endif
59 } vlc_plugin_t;
61 /**
62 * List of all plug-ins.
64 extern struct vlc_plugin_t *vlc_plugins;
66 #define MODULE_SHORTCUT_MAX 20
68 /** Plugin entry point prototype */
69 typedef int (*vlc_plugin_cb) (int (*)(void *, void *, int, ...), void *);
71 /** Core module */
72 int vlc_entry__core (int (*)(void *, void *, int, ...), void *);
74 /**
75 * Internal module descriptor
77 struct module_t
79 vlc_plugin_t *plugin; /**< Plug-in/library containing the module */
80 module_t *next;
82 /** Shortcuts to the module */
83 unsigned i_shortcuts;
84 const char **pp_shortcuts;
87 * Variables set by the module to identify itself
89 const char *psz_shortname; /**< Module name */
90 const char *psz_longname; /**< Module descriptive name */
91 const char *psz_help; /**< Long help string for "special" modules */
93 const char *psz_capability; /**< Capability */
94 int i_score; /**< Score for the capability */
96 /* Callbacks */
97 const char *activate_name;
98 const char *deactivate_name;
99 void *pf_activate;
100 void *pf_deactivate;
103 vlc_plugin_t *vlc_plugin_create(void);
104 void vlc_plugin_destroy(vlc_plugin_t *);
105 module_t *vlc_module_create(vlc_plugin_t *);
106 void vlc_module_destroy (module_t *);
108 vlc_plugin_t *vlc_plugin_describe(vlc_plugin_cb);
109 int vlc_plugin_resolve(vlc_plugin_t *, vlc_plugin_cb);
111 void module_InitBank (void);
112 size_t module_LoadPlugins( vlc_object_t * );
113 #define module_LoadPlugins(a) module_LoadPlugins(VLC_OBJECT(a))
114 void module_EndBank (bool);
115 int module_Map(vlc_object_t *, vlc_plugin_t *);
117 ssize_t module_list_cap (module_t ***, const char *);
119 int vlc_bindtextdomain (const char *);
121 /* Low-level OS-dependent handler */
124 * Loads a dynamically linked library.
126 * \param path library file path
127 * \param lazy whether to resolve the symbols lazily
128 * \return a module handle on success, or NULL on error.
130 void *vlc_dlopen(const char *path, bool) VLC_USED;
133 * Unloads a dynamic library.
135 * This function unloads a previously opened dynamically linked library
136 * using a system dependent method.
137 * \param handle handle of the library
138 * \retval 0 on success
139 * \retval -1 on error (none are defined though)
141 int vlc_dlclose(void *);
144 * Looks up a symbol from a dynamically loaded library
146 * This function looks for a named symbol within a loaded library.
148 * \param handle handle to the library
149 * \param name function name
150 * \return the address of the symbol on success, or NULL on error
152 * \note If the symbol address is NULL, errors cannot be detected. However,
153 * normal symbols such as function or global variables cannot have NULL as
154 * their address.
156 void *vlc_dlsym(void *handle, const char *) VLC_USED;
159 * Formats an error message for vlc_dlopen() or vlc_dlsym().
161 * \return a heap-allocated nul-terminated error string, or NULL.
163 char *vlc_dlerror(void) VLC_USED;
165 /* Plugins cache */
166 vlc_plugin_t *vlc_cache_load(vlc_object_t *, const char *, block_t **);
167 vlc_plugin_t *vlc_cache_lookup(vlc_plugin_t **, const char *relpath);
169 void CacheSave(vlc_object_t *, const char *, vlc_plugin_t *const *, size_t);
171 #endif /* !LIBVLC_MODULES_H */