/src/vlc/include/vlc_modules.h
Line | Count | Source (jump to first uncovered line) |
1 | | /***************************************************************************** |
2 | | * vlc_modules.h : Module descriptor and load functions |
3 | | ***************************************************************************** |
4 | | * Copyright (C) 2001-2011 VLC authors and VideoLAN |
5 | | * |
6 | | * Authors: Samuel Hocevar <sam@zoy.org> |
7 | | * |
8 | | * This program is free software; you can redistribute it and/or modify it |
9 | | * under the terms of the GNU Lesser General Public License as published by |
10 | | * the Free Software Foundation; either version 2.1 of the License, or |
11 | | * (at your option) any later version. |
12 | | * |
13 | | * This program is distributed in the hope that it will be useful, |
14 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | | * GNU Lesser General Public License for more details. |
17 | | * |
18 | | * You should have received a copy of the GNU Lesser General Public License |
19 | | * along with this program; if not, write to the Free Software Foundation, |
20 | | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
21 | | *****************************************************************************/ |
22 | | |
23 | | #ifndef VLC_MODULES_H |
24 | | #define VLC_MODULES_H 1 |
25 | | |
26 | | /** |
27 | | * \file |
28 | | * This file defines functions for modules in vlc |
29 | | */ |
30 | | |
31 | | typedef int (*vlc_activate_t)(void *func, bool forced, va_list args); |
32 | | struct vlc_logger; |
33 | | |
34 | | /***************************************************************************** |
35 | | * Exported functions. |
36 | | *****************************************************************************/ |
37 | | |
38 | | /** |
39 | | * Finds the candidate modules for given criteria. |
40 | | * |
41 | | * All candidates modules having the specified capability and name will be |
42 | | * sorted in decreasing order of priority and returned in a heap-allocated |
43 | | * table. |
44 | | * |
45 | | * \param capability capability, i.e. class of module |
46 | | * \param names string of comma-separated requested module shortcut names, |
47 | | * or NULL for defaults |
48 | | * \param strict whether to exclude modules with no unmatching shortcut names |
49 | | * \param modules storage location for the base address of a sorted table |
50 | | * of candidate modules (NULL on error) [OUT] |
51 | | * \param strict_matches storage location for the count of strictly matched |
52 | | * modules [OUT] |
53 | | * \return number of modules found or a strictly negative value on error |
54 | | */ |
55 | | VLC_API |
56 | | ssize_t vlc_module_match(const char *capability, const char *names, |
57 | | bool strict, module_t ***restrict modules, |
58 | | size_t *restrict strict_matches); |
59 | | |
60 | | /** |
61 | | * Maps a module in memory. |
62 | | * |
63 | | * This function attempts to map a given module in memory, if it is not |
64 | | * already mapped. If it is already mapped, this function does nothing. |
65 | | * |
66 | | * \param log message logger |
67 | | * \param mod module to map |
68 | | * |
69 | | * \return the module activation function on success, NULL on failure |
70 | | */ |
71 | | VLC_API |
72 | | void *vlc_module_map(struct vlc_logger *log, module_t *mod); |
73 | | |
74 | | /** |
75 | | * Finds and instantiates the best module of a certain type. |
76 | | * All candidates modules having the specified capability and name will be |
77 | | * sorted in decreasing order of priority. Then the probe callback will be |
78 | | * invoked for each module, until it succeeds (returns 0), or all candidate |
79 | | * module failed to initialize. |
80 | | * |
81 | | * The probe callback first parameter is the address of the module entry point. |
82 | | * Further parameters are passed as an argument list; it corresponds to the |
83 | | * variable arguments passed to this function. This scheme is meant to |
84 | | * support arbitrary prototypes for the module entry point. |
85 | | * |
86 | | * \param log logger for debugging (or NULL to ignore) |
87 | | * \param cap capability, i.e. class of module |
88 | | * \param name name of the module asked, if any |
89 | | * \param strict if true, do not fallback to plugin with a different name |
90 | | * but the same capability |
91 | | * \param probe module probe callback |
92 | | * \return the module or NULL in case of a failure |
93 | | */ |
94 | | VLC_API module_t *vlc_module_load(struct vlc_logger *log, const char *cap, |
95 | | const char *name, bool strict, |
96 | | vlc_activate_t probe, ... ) VLC_USED; |
97 | | |
98 | | VLC_API module_t * module_need( vlc_object_t *, const char *, const char *, bool ) VLC_USED; |
99 | 7.92M | #define module_need(a,b,c,d) module_need(VLC_OBJECT(a),b,c,d) |
100 | | |
101 | | VLC_USED |
102 | | static inline module_t *module_need_var(vlc_object_t *obj, const char *cap, |
103 | | const char *varname) |
104 | 0 | { |
105 | 0 | char *list = var_InheritString(obj, varname); |
106 | 0 | if (unlikely(list == NULL)) |
107 | 0 | return NULL; |
108 | | |
109 | 0 | module_t *m = module_need(obj, cap, list, false); |
110 | |
|
111 | 0 | free(list); |
112 | 0 | return m; |
113 | 0 | } Unexecuted instantiation: decoder.c:module_need_var Unexecuted instantiation: core.c:module_need_var Unexecuted instantiation: a52.c:module_need_var Unexecuted instantiation: dts.c:module_need_var Unexecuted instantiation: mpegaudio.c:module_need_var Unexecuted instantiation: subsusf.c:module_need_var Unexecuted instantiation: libvlc.c:module_need_var Unexecuted instantiation: file.c:module_need_var Unexecuted instantiation: help.c:module_need_var Unexecuted instantiation: cmdline.c:module_need_var Unexecuted instantiation: modules.c:module_need_var Unexecuted instantiation: bank.c:module_need_var Unexecuted instantiation: interface.c:module_need_var Unexecuted instantiation: preparser.c:module_need_var Unexecuted instantiation: access.c:module_need_var Unexecuted instantiation: decoder_device.c:module_need_var Unexecuted instantiation: decoder_helpers.c:module_need_var Unexecuted instantiation: demux.c:module_need_var Unexecuted instantiation: input.c:module_need_var Unexecuted instantiation: meta.c:module_need_var Unexecuted instantiation: services_discovery.c:module_need_var Unexecuted instantiation: stream_extractor.c:module_need_var Unexecuted instantiation: stream_filter.c:module_need_var Unexecuted instantiation: filters.c:module_need_var Unexecuted instantiation: output.c:module_need_var Unexecuted instantiation: volume.c:module_need_var Unexecuted instantiation: window.c:module_need_var Unexecuted instantiation: vout_intf.c:module_need_var Unexecuted instantiation: probe.c:module_need_var Unexecuted instantiation: keystore.c:module_need_var Unexecuted instantiation: renderer_discovery.c:module_need_var Unexecuted instantiation: cpu.c:module_need_var Unexecuted instantiation: image.c:module_need_var Unexecuted instantiation: messages.c:module_need_var Unexecuted instantiation: tracer.c:module_need_var Unexecuted instantiation: xml.c:module_need_var Unexecuted instantiation: filter.c:module_need_var Unexecuted instantiation: filter_chain.c:module_need_var Unexecuted instantiation: medialibrary.c:module_need_var Unexecuted instantiation: stream_output.c:module_need_var Unexecuted instantiation: vlm.c:module_need_var Unexecuted instantiation: fetcher.c:module_need_var Unexecuted instantiation: display.c:module_need_var Unexecuted instantiation: inhibit.c:module_need_var Unexecuted instantiation: chroma_probe.c:module_need_var |
114 | 0 | #define module_need_var(a,b,c) module_need_var(VLC_OBJECT(a),b,c) |
115 | | |
116 | | VLC_API void module_unneed( vlc_object_t *, module_t * ); |
117 | 6.82M | #define module_unneed(a,b) module_unneed(VLC_OBJECT(a),b) |
118 | | |
119 | | /** |
120 | | * Get a pointer to a module_t given it's name. |
121 | | * |
122 | | * \param name the name of the module |
123 | | * \return a pointer to the module or NULL in case of a failure |
124 | | */ |
125 | | VLC_API module_t *module_find(const char *name) VLC_USED; |
126 | | |
127 | | /** |
128 | | * Checks if a module exists. |
129 | | * |
130 | | * \param name name of the module |
131 | | * \retval true if the module exists |
132 | | * \retval false if the module does not exist (in the running installation) |
133 | | */ |
134 | | VLC_USED static inline bool module_exists(const char * name) |
135 | 0 | { |
136 | 0 | return module_find(name) != NULL; |
137 | 0 | } Unexecuted instantiation: decoder.c:module_exists Unexecuted instantiation: core.c:module_exists Unexecuted instantiation: a52.c:module_exists Unexecuted instantiation: dts.c:module_exists Unexecuted instantiation: mpegaudio.c:module_exists Unexecuted instantiation: subsusf.c:module_exists Unexecuted instantiation: libvlc.c:module_exists Unexecuted instantiation: file.c:module_exists Unexecuted instantiation: help.c:module_exists Unexecuted instantiation: cmdline.c:module_exists Unexecuted instantiation: modules.c:module_exists Unexecuted instantiation: bank.c:module_exists Unexecuted instantiation: interface.c:module_exists Unexecuted instantiation: preparser.c:module_exists Unexecuted instantiation: access.c:module_exists Unexecuted instantiation: decoder_device.c:module_exists Unexecuted instantiation: decoder_helpers.c:module_exists Unexecuted instantiation: demux.c:module_exists Unexecuted instantiation: input.c:module_exists Unexecuted instantiation: meta.c:module_exists Unexecuted instantiation: services_discovery.c:module_exists Unexecuted instantiation: stream_extractor.c:module_exists Unexecuted instantiation: stream_filter.c:module_exists Unexecuted instantiation: filters.c:module_exists Unexecuted instantiation: output.c:module_exists Unexecuted instantiation: volume.c:module_exists Unexecuted instantiation: window.c:module_exists Unexecuted instantiation: vout_intf.c:module_exists Unexecuted instantiation: probe.c:module_exists Unexecuted instantiation: keystore.c:module_exists Unexecuted instantiation: renderer_discovery.c:module_exists Unexecuted instantiation: cpu.c:module_exists Unexecuted instantiation: image.c:module_exists Unexecuted instantiation: messages.c:module_exists Unexecuted instantiation: tracer.c:module_exists Unexecuted instantiation: xml.c:module_exists Unexecuted instantiation: filter.c:module_exists Unexecuted instantiation: filter_chain.c:module_exists Unexecuted instantiation: medialibrary.c:module_exists Unexecuted instantiation: stream_output.c:module_exists Unexecuted instantiation: vlm.c:module_exists Unexecuted instantiation: fetcher.c:module_exists Unexecuted instantiation: display.c:module_exists Unexecuted instantiation: inhibit.c:module_exists Unexecuted instantiation: chroma_probe.c:module_exists |
138 | | |
139 | | /** |
140 | | * Gets the table of module configuration items. |
141 | | * |
142 | | * \note Use module_config_free() to release the allocated memory. |
143 | | * |
144 | | * \param module the module |
145 | | * \param psize the size of the configuration returned |
146 | | * \return the configuration as an array |
147 | | */ |
148 | | VLC_API module_config_t *module_config_get(const module_t *module, |
149 | | unsigned *restrict psize) VLC_USED; |
150 | | |
151 | | /** |
152 | | * Releases a configuration items table. |
153 | | * |
154 | | * \param tab base address of a table returned by module_config_get() |
155 | | */ |
156 | | VLC_API void module_config_free( module_config_t *tab); |
157 | | |
158 | | /** |
159 | | * Frees a flat list of VLC modules. |
160 | | * |
161 | | * \param list list obtained by module_list_get() |
162 | | */ |
163 | | VLC_API void module_list_free(module_t **); |
164 | | |
165 | | /** |
166 | | * Gets the flat list of VLC modules. |
167 | | * |
168 | | * \param n [OUT] pointer to the number of modules |
169 | | * \return table of module pointers (release with module_list_free()), |
170 | | * or NULL in case of error (in that case, *n is zeroed). |
171 | | */ |
172 | | VLC_API module_t ** module_list_get(size_t *n) VLC_USED; |
173 | | |
174 | | /** |
175 | | * Checks whether a module implements a capability. |
176 | | * |
177 | | * \param m the module |
178 | | * \param cap the capability to check |
179 | | * \retval true if the module has the capability |
180 | | * \retval false if the module has another capability |
181 | | */ |
182 | | VLC_API bool module_provides(const module_t *m, const char *cap); |
183 | | |
184 | | /** |
185 | | * Gets the internal name of a module. |
186 | | * |
187 | | * \param m the module |
188 | | * \return the module name |
189 | | */ |
190 | | VLC_API const char * module_get_object(const module_t *m) VLC_USED; |
191 | | |
192 | | /** |
193 | | * Gets the human-friendly name of a module. |
194 | | * |
195 | | * \param m the module |
196 | | * \param longname TRUE to have the long name of the module |
197 | | * \return the short or long name of the module |
198 | | */ |
199 | | VLC_API const char *module_get_name(const module_t *m, bool longname) VLC_USED; |
200 | 0 | #define module_GetShortName( m ) module_get_name( m, false ) |
201 | 0 | #define module_GetLongName( m ) module_get_name( m, true ) |
202 | | |
203 | | /** |
204 | | * Gets the help text for a module. |
205 | | * |
206 | | * \param m the module |
207 | | * \return the help |
208 | | */ |
209 | | VLC_API const char *module_get_help(const module_t *m) VLC_USED; |
210 | | |
211 | | /** |
212 | | * Gets the help HTML for a module. |
213 | | * |
214 | | * \param m the module |
215 | | * \return the help HTML |
216 | | */ |
217 | | VLC_API const char *module_get_help_html(const module_t *m) VLC_USED; |
218 | | |
219 | | /** |
220 | | * Gets the capability string of a module. |
221 | | * |
222 | | * \param m the module |
223 | | * \return the capability, or "none" if unspecified |
224 | | */ |
225 | | VLC_API const char *module_get_capability(const module_t *m) VLC_USED; |
226 | | |
227 | | /** |
228 | | * Gets the precedence of a module. |
229 | | * |
230 | | * \param m the module |
231 | | * return the score for the capability |
232 | | */ |
233 | | VLC_API int module_get_score(const module_t *m) VLC_USED; |
234 | | |
235 | | /** |
236 | | * Translates a string using the module's text domain |
237 | | * |
238 | | * \param m the module |
239 | | * \param s the American English ASCII string to localize |
240 | | * \return the gettext-translated string |
241 | | */ |
242 | | VLC_API const char *module_gettext(const module_t *m, const char *s) VLC_USED; |
243 | | |
244 | | VLC_USED static inline module_t *module_get_main (void) |
245 | 0 | { |
246 | 0 | return module_find ("core"); |
247 | 0 | } Unexecuted instantiation: decoder.c:module_get_main Unexecuted instantiation: core.c:module_get_main Unexecuted instantiation: a52.c:module_get_main Unexecuted instantiation: dts.c:module_get_main Unexecuted instantiation: mpegaudio.c:module_get_main Unexecuted instantiation: subsusf.c:module_get_main Unexecuted instantiation: libvlc.c:module_get_main Unexecuted instantiation: file.c:module_get_main Unexecuted instantiation: help.c:module_get_main Unexecuted instantiation: cmdline.c:module_get_main Unexecuted instantiation: modules.c:module_get_main Unexecuted instantiation: bank.c:module_get_main Unexecuted instantiation: interface.c:module_get_main Unexecuted instantiation: preparser.c:module_get_main Unexecuted instantiation: access.c:module_get_main Unexecuted instantiation: decoder_device.c:module_get_main Unexecuted instantiation: decoder_helpers.c:module_get_main Unexecuted instantiation: demux.c:module_get_main Unexecuted instantiation: input.c:module_get_main Unexecuted instantiation: meta.c:module_get_main Unexecuted instantiation: services_discovery.c:module_get_main Unexecuted instantiation: stream_extractor.c:module_get_main Unexecuted instantiation: stream_filter.c:module_get_main Unexecuted instantiation: filters.c:module_get_main Unexecuted instantiation: output.c:module_get_main Unexecuted instantiation: volume.c:module_get_main Unexecuted instantiation: window.c:module_get_main Unexecuted instantiation: vout_intf.c:module_get_main Unexecuted instantiation: probe.c:module_get_main Unexecuted instantiation: keystore.c:module_get_main Unexecuted instantiation: renderer_discovery.c:module_get_main Unexecuted instantiation: cpu.c:module_get_main Unexecuted instantiation: image.c:module_get_main Unexecuted instantiation: messages.c:module_get_main Unexecuted instantiation: tracer.c:module_get_main Unexecuted instantiation: xml.c:module_get_main Unexecuted instantiation: filter.c:module_get_main Unexecuted instantiation: filter_chain.c:module_get_main Unexecuted instantiation: medialibrary.c:module_get_main Unexecuted instantiation: stream_output.c:module_get_main Unexecuted instantiation: vlm.c:module_get_main Unexecuted instantiation: fetcher.c:module_get_main Unexecuted instantiation: display.c:module_get_main Unexecuted instantiation: inhibit.c:module_get_main Unexecuted instantiation: chroma_probe.c:module_get_main |
248 | | |
249 | | VLC_USED static inline bool module_is_main( const module_t * p_module ) |
250 | 0 | { |
251 | 0 | return !strcmp( module_get_object( p_module ), "core" ); |
252 | 0 | } Unexecuted instantiation: decoder.c:module_is_main Unexecuted instantiation: core.c:module_is_main Unexecuted instantiation: a52.c:module_is_main Unexecuted instantiation: dts.c:module_is_main Unexecuted instantiation: mpegaudio.c:module_is_main Unexecuted instantiation: subsusf.c:module_is_main Unexecuted instantiation: libvlc.c:module_is_main Unexecuted instantiation: file.c:module_is_main Unexecuted instantiation: help.c:module_is_main Unexecuted instantiation: cmdline.c:module_is_main Unexecuted instantiation: modules.c:module_is_main Unexecuted instantiation: bank.c:module_is_main Unexecuted instantiation: interface.c:module_is_main Unexecuted instantiation: preparser.c:module_is_main Unexecuted instantiation: access.c:module_is_main Unexecuted instantiation: decoder_device.c:module_is_main Unexecuted instantiation: decoder_helpers.c:module_is_main Unexecuted instantiation: demux.c:module_is_main Unexecuted instantiation: input.c:module_is_main Unexecuted instantiation: meta.c:module_is_main Unexecuted instantiation: services_discovery.c:module_is_main Unexecuted instantiation: stream_extractor.c:module_is_main Unexecuted instantiation: stream_filter.c:module_is_main Unexecuted instantiation: filters.c:module_is_main Unexecuted instantiation: output.c:module_is_main Unexecuted instantiation: volume.c:module_is_main Unexecuted instantiation: window.c:module_is_main Unexecuted instantiation: vout_intf.c:module_is_main Unexecuted instantiation: probe.c:module_is_main Unexecuted instantiation: keystore.c:module_is_main Unexecuted instantiation: renderer_discovery.c:module_is_main Unexecuted instantiation: cpu.c:module_is_main Unexecuted instantiation: image.c:module_is_main Unexecuted instantiation: messages.c:module_is_main Unexecuted instantiation: tracer.c:module_is_main Unexecuted instantiation: xml.c:module_is_main Unexecuted instantiation: filter.c:module_is_main Unexecuted instantiation: filter_chain.c:module_is_main Unexecuted instantiation: medialibrary.c:module_is_main Unexecuted instantiation: stream_output.c:module_is_main Unexecuted instantiation: vlm.c:module_is_main Unexecuted instantiation: fetcher.c:module_is_main Unexecuted instantiation: display.c:module_is_main Unexecuted instantiation: inhibit.c:module_is_main Unexecuted instantiation: chroma_probe.c:module_is_main |
253 | | |
254 | | #endif /* VLC_MODULES_H */ |