/src/vlc/include/vlc_plugin.h
Line | Count | Source (jump to first uncovered line) |
1 | | /***************************************************************************** |
2 | | * vlc_plugin.h : Macros used from within a module. |
3 | | ***************************************************************************** |
4 | | * Copyright (C) 2001-2006 VLC authors and VideoLAN |
5 | | * Copyright © 2007-2009 Rémi Denis-Courmont |
6 | | * |
7 | | * Authors: Samuel Hocevar <sam@zoy.org> |
8 | | * |
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. |
13 | | * |
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. |
18 | | * |
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 | | *****************************************************************************/ |
23 | | |
24 | | #ifndef LIBVLC_MODULES_MACROS_H |
25 | | # define LIBVLC_MODULES_MACROS_H 1 |
26 | | |
27 | | /** |
28 | | * \file |
29 | | * This file implements plugin (module) macros used to define a vlc module. |
30 | | */ |
31 | | |
32 | | enum vlc_module_properties |
33 | | { |
34 | | VLC_MODULE_CREATE, |
35 | | VLC_CONFIG_CREATE, |
36 | | |
37 | | /* DO NOT EVER REMOVE, INSERT OR REPLACE ANY ITEM! It would break the ABI! |
38 | | * Append new items at the end ONLY. */ |
39 | | VLC_MODULE_CPU_REQUIREMENT=0x100, |
40 | | VLC_MODULE_SHORTCUT, |
41 | | VLC_MODULE_CAPABILITY, |
42 | | VLC_MODULE_SCORE, |
43 | | VLC_MODULE_CB_OPEN, |
44 | | VLC_MODULE_CB_CLOSE, |
45 | | VLC_MODULE_NO_UNLOAD, |
46 | | VLC_MODULE_NAME, |
47 | | VLC_MODULE_SHORTNAME, |
48 | | VLC_MODULE_DESCRIPTION, |
49 | | VLC_MODULE_HELP, |
50 | | VLC_MODULE_TEXTDOMAIN, |
51 | | /* Insert new VLC_MODULE_* here */ |
52 | | |
53 | | /* DO NOT EVER REMOVE, INSERT OR REPLACE ANY ITEM! It would break the ABI! |
54 | | * Append new items at the end ONLY. */ |
55 | | VLC_CONFIG_NAME=0x1000, |
56 | | /* command line name (args=const char *) */ |
57 | | |
58 | | VLC_CONFIG_VALUE, |
59 | | /* actual value (args=int64_t/double/const char *) */ |
60 | | |
61 | | VLC_CONFIG_RANGE, |
62 | | /* minimum value (args=int64_t/double/const char * twice) */ |
63 | | |
64 | | VLC_CONFIG_ADVANCED_RESERVED, |
65 | | /* reserved - do not use */ |
66 | | |
67 | | VLC_CONFIG_VOLATILE, |
68 | | /* don't write variable to storage (args=none) */ |
69 | | |
70 | | VLC_CONFIG_PERSISTENT_OBSOLETE, |
71 | | /* unused (ignored) */ |
72 | | |
73 | | VLC_CONFIG_PRIVATE, |
74 | | /* hide from user (args=none) */ |
75 | | |
76 | | VLC_CONFIG_REMOVED, |
77 | | /* tag as no longer supported (args=none) */ |
78 | | |
79 | | VLC_CONFIG_CAPABILITY, |
80 | | /* capability for a module or list thereof (args=const char*) */ |
81 | | |
82 | | VLC_CONFIG_SHORTCUT, |
83 | | /* one-character (short) command line option name (args=char) */ |
84 | | |
85 | | VLC_CONFIG_OLDNAME_OBSOLETE, |
86 | | /* unused (ignored) */ |
87 | | |
88 | | VLC_CONFIG_SAFE, |
89 | | /* tag as modifiable by untrusted input item "sources" (args=none) */ |
90 | | |
91 | | VLC_CONFIG_DESC, |
92 | | /* description (args=const char *, const char *, const char *) */ |
93 | | |
94 | | VLC_CONFIG_LIST_OBSOLETE, |
95 | | /* unused (ignored) */ |
96 | | |
97 | | VLC_CONFIG_ADD_ACTION_OBSOLETE, |
98 | | /* unused (ignored) */ |
99 | | |
100 | | VLC_CONFIG_LIST, |
101 | | /* list of suggested values |
102 | | * (args=size_t, const <type> *, const char *const *) */ |
103 | | |
104 | | VLC_CONFIG_LIST_CB_OBSOLETE, |
105 | | /* unused (ignored) */ |
106 | | |
107 | | /* Insert new VLC_CONFIG_* here */ |
108 | | }; |
109 | | |
110 | | /* Configuration hint types */ |
111 | 0 | #define CONFIG_HINT_CATEGORY 0x02 /* Start of new category */ |
112 | | |
113 | 0 | #define CONFIG_SUBCATEGORY 0x07 /* Set subcategory */ |
114 | 0 | #define CONFIG_SECTION 0x08 /* Start of new section */ |
115 | | |
116 | | /* Configuration item types */ |
117 | 1.60k | #define CONFIG_ITEM_FLOAT 0x20 /* Float option */ |
118 | 2.23k | #define CONFIG_ITEM_INTEGER 0x40 /* Integer option */ |
119 | | #define CONFIG_ITEM_RGB 0x41 /* RGB color option */ |
120 | 2.01k | #define CONFIG_ITEM_BOOL 0x60 /* Bool option */ |
121 | 648 | #define CONFIG_ITEM_STRING 0x80 /* String option */ |
122 | | #define CONFIG_ITEM_PASSWORD 0x81 /* Password option (*) */ |
123 | | #define CONFIG_ITEM_KEY 0x82 /* Hot key option */ |
124 | 0 | #define CONFIG_ITEM_MODULE 0x84 /* Module option */ |
125 | | #define CONFIG_ITEM_MODULE_CAT 0x85 /* Module option */ |
126 | | #define CONFIG_ITEM_MODULE_LIST 0x86 /* Module option */ |
127 | | #define CONFIG_ITEM_MODULE_LIST_CAT 0x87 /* Module option */ |
128 | | #define CONFIG_ITEM_LOADFILE 0x8C /* Read file option */ |
129 | | #define CONFIG_ITEM_SAVEFILE 0x8D /* Written file option */ |
130 | | #define CONFIG_ITEM_DIRECTORY 0x8E /* Directory option */ |
131 | | #define CONFIG_ITEM_FONT 0x8F /* Font option */ |
132 | | |
133 | | /* reduce specific type to type class */ |
134 | 978 | #define CONFIG_CLASS(x) ((x) & ~0x1F) |
135 | | |
136 | | /* is proper option, not a special hint type? */ |
137 | 5.40k | #define CONFIG_ITEM(x) (((x) & ~0xF) != 0) |
138 | | |
139 | | #define IsConfigStringType(type) \ |
140 | 648 | (((type) & CONFIG_ITEM_STRING) != 0) |
141 | | #define IsConfigIntegerType(type) \ |
142 | 3.24k | (((type) & CONFIG_ITEM_INTEGER) != 0) |
143 | | #define IsConfigFloatType(type) \ |
144 | 1.60k | ((type) == CONFIG_ITEM_FLOAT) |
145 | | |
146 | | /* Config category */ |
147 | | enum vlc_config_cat |
148 | | { |
149 | | /* Hidden category. |
150 | | Any options under this will be hidden in the GUI preferences, but will |
151 | | be listed in cmdline help output. */ |
152 | | CAT_HIDDEN = -1, |
153 | | |
154 | | CAT_UNKNOWN = 0, |
155 | | |
156 | | CAT_INTERFACE = 1, |
157 | | CAT_AUDIO = 2, |
158 | | CAT_VIDEO = 3, |
159 | | CAT_INPUT = 4, |
160 | | CAT_SOUT = 5, |
161 | | CAT_ADVANCED = 6, |
162 | | CAT_PLAYLIST = 7, |
163 | | }; |
164 | | |
165 | | /* Config subcategory */ |
166 | | enum vlc_config_subcat |
167 | | { |
168 | | /* Hidden subcategory. |
169 | | Any options under this will be hidden in the GUI preferences, but will |
170 | | be listed in cmdline help output. */ |
171 | | SUBCAT_HIDDEN = -1, |
172 | | |
173 | | SUBCAT_UNKNOWN = 0, |
174 | | |
175 | | SUBCAT_INTERFACE_GENERAL = 101, |
176 | | SUBCAT_INTERFACE_MAIN = 102, |
177 | | SUBCAT_INTERFACE_CONTROL = 103, |
178 | | SUBCAT_INTERFACE_HOTKEYS = 104, |
179 | | |
180 | | SUBCAT_AUDIO_GENERAL = 201, |
181 | | SUBCAT_AUDIO_AOUT = 202, |
182 | | SUBCAT_AUDIO_AFILTER = 203, |
183 | | SUBCAT_AUDIO_VISUAL = 204, |
184 | | SUBCAT_AUDIO_RESAMPLER = 206, |
185 | | |
186 | | SUBCAT_VIDEO_GENERAL = 301, |
187 | | SUBCAT_VIDEO_VOUT = 302, |
188 | | SUBCAT_VIDEO_VFILTER = 303, |
189 | | SUBCAT_VIDEO_SUBPIC = 305, |
190 | | SUBCAT_VIDEO_SPLITTER = 306, |
191 | | |
192 | | SUBCAT_INPUT_GENERAL = 401, |
193 | | SUBCAT_INPUT_ACCESS = 402, |
194 | | SUBCAT_INPUT_DEMUX = 403, |
195 | | SUBCAT_INPUT_VCODEC = 404, |
196 | | SUBCAT_INPUT_ACODEC = 405, |
197 | | SUBCAT_INPUT_SCODEC = 406, |
198 | | SUBCAT_INPUT_STREAM_FILTER = 407, |
199 | | |
200 | | SUBCAT_SOUT_GENERAL = 501, |
201 | | SUBCAT_SOUT_STREAM = 502, |
202 | | SUBCAT_SOUT_MUX = 503, |
203 | | SUBCAT_SOUT_ACO = 504, |
204 | | SUBCAT_SOUT_PACKETIZER = 505, |
205 | | SUBCAT_SOUT_VOD = 507, |
206 | | SUBCAT_SOUT_RENDERER = 508, |
207 | | |
208 | | SUBCAT_ADVANCED_MISC = 602, |
209 | | SUBCAT_ADVANCED_NETWORK = 603, |
210 | | |
211 | | SUBCAT_PLAYLIST_GENERAL = 701, |
212 | | SUBCAT_PLAYLIST_SD = 702, |
213 | | SUBCAT_PLAYLIST_EXPORT = 703, |
214 | | }; |
215 | | |
216 | | /** |
217 | | * Current plugin ABI version |
218 | | */ |
219 | | #define VLC_API_VERSION_STRING "4.0.6" |
220 | | |
221 | | /***************************************************************************** |
222 | | * Add a few defines. You do not want to read this section. Really. |
223 | | *****************************************************************************/ |
224 | | |
225 | | /* Explanation: |
226 | | * |
227 | | * if linking a module statically, we will need: |
228 | | * #define MODULE_FUNC( zog ) module_foo_zog |
229 | | * |
230 | | * this can't easily be done with the C preprocessor, thus a few ugly hacks. |
231 | | */ |
232 | | |
233 | | /* I need to do _this_ to change « foo bar » to « module_foo_bar » ! */ |
234 | 2 | #define CONCATENATE( y, z ) CRUDE_HACK( y, z ) |
235 | 2 | #define CRUDE_HACK( y, z ) y##__##z |
236 | | #define STRINGIFY_NAME_( z ) #z |
237 | | #define STRINGIFY_NAME( z ) STRINGIFY_NAME_( z ) |
238 | | |
239 | | #if defined(__cplusplus) |
240 | | #define EXTERN_SYMBOL extern "C" |
241 | | #else |
242 | | #define EXTERN_SYMBOL |
243 | | #endif |
244 | | |
245 | | #if !defined(MODULE_STRING) && defined(MODULE_NAME) |
246 | | # define MODULE_STRING STRINGIFY_NAME(MODULE_NAME) |
247 | | #endif |
248 | | |
249 | | // defines a statically linked module entry point |
250 | | #define VLC_ENTRY_FUNC(name) int (name)(vlc_set_cb, void *) |
251 | | // name of the module entry point table |
252 | 2 | #define VLC_MODULE_ENTRY(name) CONCATENATE(vlc_entry, name) |
253 | | // declare a vlc_plugin_cb |
254 | | #define VLC_DECL_MODULE_ENTRY(name) VLC_ENTRY_FUNC(VLC_MODULE_ENTRY(name)) |
255 | | |
256 | | /* If the module is built-in, then we need to define foo_InitModule instead |
257 | | * of InitModule. Same for Activate- and DeactivateModule. */ |
258 | | #ifdef VLC_DYNAMIC_PLUGIN |
259 | | # define VLC_SYMBOL(symbol) symbol |
260 | | # define VLC_MODULE_NAME_HIDDEN_SYMBOL \ |
261 | | EXTERN_SYMBOL const char vlc_module_name[] = MODULE_STRING; |
262 | | #else |
263 | | # define VLC_SYMBOL(symbol) CONCATENATE(symbol, MODULE_NAME) |
264 | | # define VLC_MODULE_NAME_HIDDEN_SYMBOL |
265 | | #endif |
266 | | |
267 | | #define CDECL_SYMBOL |
268 | | #if defined (VLC_DYNAMIC_PLUGIN) |
269 | | # if defined (_WIN32) |
270 | | # define DLL_SYMBOL __declspec(dllexport) |
271 | | # undef CDECL_SYMBOL |
272 | | # define CDECL_SYMBOL __cdecl |
273 | | # elif defined (__GNUC__) |
274 | | # define DLL_SYMBOL __attribute__((visibility("default"))) |
275 | | # else |
276 | | # define DLL_SYMBOL |
277 | | # endif |
278 | | #else |
279 | | # define DLL_SYMBOL |
280 | | #endif |
281 | | |
282 | | struct vlc_param; |
283 | | |
284 | | EXTERN_SYMBOL typedef int (*vlc_set_cb) (void *, void *, int, ...); |
285 | | |
286 | | /** Plugin entry point prototype */ |
287 | | typedef int (*vlc_plugin_cb) (vlc_set_cb, void *); |
288 | | |
289 | 1.03k | #define vlc_plugin_set(...) vlc_set (opaque, NULL, __VA_ARGS__) |
290 | 4 | #define vlc_module_set(...) vlc_set (opaque, module, __VA_ARGS__) |
291 | 3.05k | #define vlc_config_set(...) vlc_set (opaque, config, __VA_ARGS__) |
292 | | |
293 | | EXTERN_SYMBOL DLL_SYMBOL |
294 | | int CDECL_SYMBOL VLC_SYMBOL(vlc_entry)(vlc_set_cb, void *); |
295 | | EXTERN_SYMBOL DLL_SYMBOL |
296 | | int CDECL_SYMBOL VLC_SYMBOL(vlc_entry_cfg_int_enum)(const char *name, |
297 | | int64_t **values, char ***descs); |
298 | | EXTERN_SYMBOL DLL_SYMBOL |
299 | | int CDECL_SYMBOL VLC_SYMBOL(vlc_entry_cfg_str_enum)(const char *name, |
300 | | char ***values, char ***descs); |
301 | | |
302 | | /* Workaround for lack of C++ compound literals support in some compilers */ |
303 | | #ifdef __cplusplus |
304 | | # define VLC_CHECKED_TYPE(type, value) [](type v){ return v; }(value) |
305 | | #else |
306 | | # define VLC_CHECKED_TYPE(type, value) (type){ value } |
307 | | #endif |
308 | | |
309 | | /* |
310 | | * InitModule: this function is called once and only once, when the module |
311 | | * is looked at for the first time. We get the useful data from it, for |
312 | | * instance the module name, its shortcuts, its capabilities... we also create |
313 | | * a copy of its config because the module can be unloaded at any time. |
314 | | */ |
315 | | #define vlc_module_begin() \ |
316 | | EXTERN_SYMBOL DLL_SYMBOL \ |
317 | 2 | int CDECL_SYMBOL VLC_SYMBOL(vlc_entry)(vlc_set_cb vlc_set, void *opaque) \ |
318 | 2 | { \ |
319 | 2 | module_t *module; \ |
320 | 2 | struct vlc_param *config = NULL; \ |
321 | 2 | if (vlc_plugin_set (VLC_MODULE_CREATE, &module)) \ |
322 | 2 | goto error; \ |
323 | 2 | if (vlc_module_set (VLC_MODULE_NAME, (MODULE_STRING))) \ |
324 | 2 | goto error; |
325 | | |
326 | | #define vlc_module_end() \ |
327 | 2 | (void) config; \ |
328 | 2 | return 0; \ |
329 | 0 | error: \ |
330 | 0 | return -1; \ |
331 | 2 | } \ |
332 | | VLC_MODULE_NAME_HIDDEN_SYMBOL \ |
333 | | VLC_METADATA_EXPORTS |
334 | | |
335 | | #define add_submodule( ) \ |
336 | | if (vlc_plugin_set (VLC_MODULE_CREATE, &module)) \ |
337 | | goto error; |
338 | | |
339 | | #define add_shortcut( ... ) \ |
340 | | { \ |
341 | | const char *shortcuts[] = { __VA_ARGS__ }; \ |
342 | | if (vlc_module_set (VLC_MODULE_SHORTCUT, \ |
343 | | sizeof(shortcuts)/sizeof(shortcuts[0]), shortcuts)) \ |
344 | | goto error; \ |
345 | | } |
346 | | |
347 | | #define set_shortname( shortname ) \ |
348 | | if (vlc_module_set (VLC_MODULE_SHORTNAME, VLC_CHECKED_TYPE(const char *, shortname))) \ |
349 | | goto error; |
350 | | |
351 | | #define set_description( desc ) \ |
352 | 2 | if (vlc_module_set (VLC_MODULE_DESCRIPTION, VLC_CHECKED_TYPE(const char *, desc))) \ |
353 | 2 | goto error; |
354 | | |
355 | | #define set_help( help ) \ |
356 | | if (vlc_module_set (VLC_MODULE_HELP, VLC_CHECKED_TYPE(const char *, help))) \ |
357 | | goto error; |
358 | | |
359 | | #define set_capability( cap, score ) \ |
360 | | if (vlc_module_set (VLC_MODULE_CAPABILITY, VLC_CHECKED_TYPE(const char *, cap)) \ |
361 | | || vlc_module_set (VLC_MODULE_SCORE, VLC_CHECKED_TYPE(int, score))) \ |
362 | | goto error; |
363 | | |
364 | | #define set_callback(activate) \ |
365 | | if (vlc_module_set(VLC_MODULE_CB_OPEN, #activate, (void *)(activate))) \ |
366 | | goto error; |
367 | | |
368 | | #define set_callbacks( activate, deactivate ) \ |
369 | | set_callback(activate) \ |
370 | | if (vlc_module_set(VLC_MODULE_CB_CLOSE, #deactivate, \ |
371 | | (void (*)(vlc_object_t *))( deactivate ))) \ |
372 | | goto error; |
373 | | |
374 | | #define cannot_unload_broken_library( ) \ |
375 | | if (vlc_module_set (VLC_MODULE_NO_UNLOAD)) \ |
376 | | goto error; |
377 | | |
378 | | #define set_text_domain( dom ) \ |
379 | | if (vlc_plugin_set (VLC_MODULE_TEXTDOMAIN, VLC_CHECKED_TYPE(const char *, dom))) \ |
380 | | goto error; |
381 | | |
382 | | /***************************************************************************** |
383 | | * Macros used to build the configuration structure. |
384 | | * |
385 | | * Note that internally we support only 3 types of config data: int, float |
386 | | * and string. |
387 | | * The other types declared here just map to one of these 3 basic types but |
388 | | * have the advantage of also providing very good hints to a configuration |
389 | | * interface so as to make it more user friendly. |
390 | | * The configuration structure also includes category hints. These hints can |
391 | | * provide a configuration interface with some very useful data and again |
392 | | * allow for a more user friendly interface. |
393 | | *****************************************************************************/ |
394 | | |
395 | | #define add_type_inner( type ) \ |
396 | 1.03k | vlc_plugin_set (VLC_CONFIG_CREATE, (type), &config); |
397 | | |
398 | | #define add_typedesc_inner( type, text, longtext ) \ |
399 | 942 | add_type_inner( type ) \ |
400 | 942 | vlc_config_set (VLC_CONFIG_DESC, VLC_CHECKED_TYPE(const char *, text), \ |
401 | 942 | VLC_CHECKED_TYPE(const char *, longtext)); |
402 | | |
403 | | #define add_typename_inner(type, name, text, longtext) \ |
404 | 880 | add_typedesc_inner(type, text, longtext) \ |
405 | 880 | vlc_config_set (VLC_CONFIG_NAME, VLC_CHECKED_TYPE(const char *, name)); |
406 | | |
407 | | #define add_string_inner(type, name, text, longtext, v) \ |
408 | 618 | add_typename_inner(type, name, text, longtext) \ |
409 | 618 | vlc_config_set (VLC_CONFIG_VALUE, VLC_CHECKED_TYPE(const char *, v)); |
410 | | |
411 | | #define add_int_inner(type, name, text, longtext, v) \ |
412 | 112 | add_typename_inner(type, name, text, longtext) \ |
413 | 112 | vlc_config_set (VLC_CONFIG_VALUE, VLC_CHECKED_TYPE(int64_t, v)); |
414 | | |
415 | | |
416 | | #define set_subcategory( id ) \ |
417 | 52 | add_type_inner( CONFIG_SUBCATEGORY ) \ |
418 | 52 | vlc_config_set (VLC_CONFIG_VALUE, VLC_CHECKED_TYPE(int64_t, id)); |
419 | | |
420 | | #define set_section( text, longtext ) \ |
421 | 40 | add_typedesc_inner( CONFIG_SECTION, text, longtext ) |
422 | | |
423 | | #ifndef VLC_DYNAMIC_PLUGIN |
424 | | #define add_category_hint(text, longtext) \ |
425 | 22 | add_typedesc_inner( CONFIG_HINT_CATEGORY, text, longtext ) |
426 | | #endif |
427 | | |
428 | | #define add_string( name, value, text, longtext ) \ |
429 | 116 | add_string_inner(CONFIG_ITEM_STRING, name, text, longtext, value) |
430 | | |
431 | | #define add_password(name, value, text, longtext) \ |
432 | 2 | add_string_inner(CONFIG_ITEM_PASSWORD, name, text, longtext, value) |
433 | | |
434 | | #define add_loadfile(name, value, text, longtext) \ |
435 | 12 | add_string_inner(CONFIG_ITEM_LOADFILE, name, text, longtext, value) |
436 | | |
437 | | #define add_savefile(name, value, text, longtext) \ |
438 | | add_string_inner(CONFIG_ITEM_SAVEFILE, name, text, longtext, value) |
439 | | |
440 | | #define add_directory(name, value, text, longtext) \ |
441 | 6 | add_string_inner(CONFIG_ITEM_DIRECTORY, name, text, longtext, value) |
442 | | |
443 | | #define add_font(name, value, text, longtext) \ |
444 | | add_string_inner(CONFIG_ITEM_FONT, name, text, longtext, value) |
445 | | |
446 | | #define add_module(name, cap, value, text, longtext) \ |
447 | 18 | add_string_inner(CONFIG_ITEM_MODULE, name, text, longtext, value) \ |
448 | 18 | vlc_config_set (VLC_CONFIG_CAPABILITY, VLC_CHECKED_TYPE(const char *, cap)); |
449 | | |
450 | | #define add_module_list(name, cap, value, text, longtext) \ |
451 | 10 | add_string_inner(CONFIG_ITEM_MODULE_LIST, name, text, longtext, value) \ |
452 | 10 | vlc_config_set (VLC_CONFIG_CAPABILITY, VLC_CHECKED_TYPE(const char *, cap)); |
453 | | |
454 | | #ifndef VLC_DYNAMIC_PLUGIN |
455 | | #define add_module_cat(name, subcategory, value, text, longtext) \ |
456 | 2 | add_string_inner(CONFIG_ITEM_MODULE_CAT, name, text, longtext, value) \ |
457 | 2 | change_integer_range (subcategory /* gruik */, 0); |
458 | | |
459 | | #define add_module_list_cat(name, subcategory, value, text, longtext) \ |
460 | 4 | add_string_inner(CONFIG_ITEM_MODULE_LIST_CAT, name, text, longtext, \ |
461 | 4 | value) \ |
462 | 4 | change_integer_range (subcategory /* gruik */, 0); |
463 | | #endif |
464 | | |
465 | | #define add_integer( name, value, text, longtext ) \ |
466 | 112 | add_int_inner(CONFIG_ITEM_INTEGER, name, text, longtext, value) |
467 | | |
468 | | #define add_rgb(name, value, text, longtext) \ |
469 | | add_int_inner(CONFIG_ITEM_RGB, name, text, longtext, value) \ |
470 | | change_integer_range( 0, 0xFFFFFF ) |
471 | | |
472 | | #define add_key(name, value, text, longtext) \ |
473 | 224 | add_string_inner(CONFIG_ITEM_KEY, "global-" name, text, longtext, \ |
474 | 224 | KEY_UNSET) \ |
475 | 224 | add_string_inner(CONFIG_ITEM_KEY, name, text, longtext, value) |
476 | | |
477 | | #define add_integer_with_range( name, value, min, max, text, longtext ) \ |
478 | 2 | add_integer( name, value, text, longtext ) \ |
479 | 2 | change_integer_range( min, max ) |
480 | | |
481 | | #define add_float( name, v, text, longtext ) \ |
482 | 20 | add_typename_inner(CONFIG_ITEM_FLOAT, name, text, longtext) \ |
483 | 20 | vlc_config_set (VLC_CONFIG_VALUE, VLC_CHECKED_TYPE(double, v)); |
484 | | |
485 | | #define add_float_with_range( name, value, min, max, text, longtext ) \ |
486 | | add_float( name, value, text, longtext ) \ |
487 | | change_float_range( min, max ) |
488 | | |
489 | | #define add_bool( name, v, text, longtext ) \ |
490 | 130 | add_typename_inner(CONFIG_ITEM_BOOL, name, text, longtext) \ |
491 | 130 | if (v) vlc_config_set (VLC_CONFIG_VALUE, (int64_t)true); |
492 | | |
493 | | /* For removed option */ |
494 | | #define add_obsolete_inner( name, type ) \ |
495 | 36 | add_type_inner( type ) \ |
496 | 36 | vlc_config_set (VLC_CONFIG_NAME, VLC_CHECKED_TYPE(const char *, name)); \ |
497 | 36 | vlc_config_set (VLC_CONFIG_REMOVED); |
498 | | |
499 | | #define add_obsolete_bool( name ) \ |
500 | 10 | add_obsolete_inner( name, CONFIG_ITEM_BOOL ) |
501 | | |
502 | | #define add_obsolete_integer( name ) \ |
503 | 4 | add_obsolete_inner( name, CONFIG_ITEM_INTEGER ) |
504 | | |
505 | | #define add_obsolete_float( name ) \ |
506 | 2 | add_obsolete_inner( name, CONFIG_ITEM_FLOAT ) |
507 | | |
508 | | #define add_obsolete_string( name ) \ |
509 | 20 | add_obsolete_inner( name, CONFIG_ITEM_STRING ) |
510 | | |
511 | | /* Modifier macros for the config options (used for fine tuning) */ |
512 | | |
513 | | #define change_short( ch ) \ |
514 | 28 | vlc_config_set (VLC_CONFIG_SHORTCUT, VLC_CHECKED_TYPE(char, ch)); |
515 | | |
516 | | #define change_string_list( list, list_text ) \ |
517 | 12 | vlc_config_set (VLC_CONFIG_LIST, \ |
518 | 12 | ARRAY_SIZE(list), \ |
519 | 12 | VLC_CHECKED_TYPE(const char *const *, list), \ |
520 | 12 | VLC_CHECKED_TYPE(const char *const *, list_text)); |
521 | | |
522 | | #define change_integer_list( list, list_text ) \ |
523 | 30 | vlc_config_set (VLC_CONFIG_LIST, \ |
524 | 30 | ARRAY_SIZE(list), \ |
525 | 30 | VLC_CHECKED_TYPE(const int *, list), \ |
526 | 30 | VLC_CHECKED_TYPE(const char *const *, list_text)); |
527 | | |
528 | | #define change_integer_range( minv, maxv ) \ |
529 | 26 | vlc_config_set (VLC_CONFIG_RANGE, VLC_CHECKED_TYPE(int64_t, minv), \ |
530 | 26 | VLC_CHECKED_TYPE(int64_t, maxv)); |
531 | | |
532 | | #define change_float_range( minv, maxv ) \ |
533 | 4 | vlc_config_set (VLC_CONFIG_RANGE, VLC_CHECKED_TYPE(double, minv), \ |
534 | 4 | VLC_CHECKED_TYPE(double, maxv)); |
535 | | |
536 | | /* For options that are saved but hidden from the preferences panel */ |
537 | | #define change_private() \ |
538 | 28 | vlc_config_set (VLC_CONFIG_PRIVATE); |
539 | | |
540 | | /* For options that cannot be saved in the configuration */ |
541 | | #define change_volatile() \ |
542 | 26 | change_private() \ |
543 | 26 | vlc_config_set (VLC_CONFIG_VOLATILE); |
544 | | |
545 | | #define change_safe() \ |
546 | 114 | vlc_config_set (VLC_CONFIG_SAFE); |
547 | | |
548 | | /* Configuration item choice enumerators */ |
549 | | #define VLC_CONFIG_INTEGER_ENUM(cb) \ |
550 | | EXTERN_SYMBOL DLL_SYMBOL \ |
551 | | int CDECL_SYMBOL VLC_SYMBOL(vlc_entry_cfg_int_enum)(const char *name, \ |
552 | | int64_t **values, char ***descs) \ |
553 | | { \ |
554 | | return (cb)(name, values, descs); \ |
555 | | } |
556 | | |
557 | | #define VLC_CONFIG_STRING_ENUM(cb) \ |
558 | | EXTERN_SYMBOL DLL_SYMBOL \ |
559 | | int CDECL_SYMBOL VLC_SYMBOL(vlc_entry_cfg_str_enum)(const char *name, \ |
560 | | char ***values, char ***descs) \ |
561 | | { \ |
562 | | return (cb)(name, values, descs); \ |
563 | | } |
564 | | |
565 | | /* Meta data plugin exports */ |
566 | | #define VLC_META_EXPORT( name, value ) \ |
567 | | EXTERN_SYMBOL DLL_SYMBOL const char * CDECL_SYMBOL \ |
568 | | VLC_SYMBOL(vlc_entry_ ## name)(void); \ |
569 | | EXTERN_SYMBOL DLL_SYMBOL const char * CDECL_SYMBOL \ |
570 | | VLC_SYMBOL(vlc_entry_ ## name)(void) \ |
571 | 0 | { \ |
572 | 0 | return value; \ |
573 | 0 | } Unexecuted instantiation: vlc_entry_api_version__core Unexecuted instantiation: vlc_entry_copyright__core Unexecuted instantiation: vlc_entry_license__core |
574 | | |
575 | | #define VLC_API_VERSION_EXPORT \ |
576 | | VLC_META_EXPORT(api_version, VLC_API_VERSION_STRING) |
577 | | |
578 | | #define VLC_COPYRIGHT_VIDEOLAN \ |
579 | | "\x43\x6f\x70\x79\x72\x69\x67\x68\x74\x20\x28\x43\x29\x20\x74\x68" \ |
580 | | "\x65\x20\x56\x69\x64\x65\x6f\x4c\x41\x4e\x20\x56\x4c\x43\x20\x6d" \ |
581 | | "\x65\x64\x69\x61\x20\x70\x6c\x61\x79\x65\x72\x20\x64\x65\x76\x65" \ |
582 | | "\x6c\x6f\x70\x65\x72\x73" |
583 | | #define VLC_LICENSE_LGPL_2_1_PLUS \ |
584 | | "\x4c\x69\x63\x65\x6e\x73\x65\x64\x20\x75\x6e\x64\x65\x72\x20\x74" \ |
585 | | "\x68\x65\x20\x74\x65\x72\x6d\x73\x20\x6f\x66\x20\x74\x68\x65\x20" \ |
586 | | "\x47\x4e\x55\x20\x4c\x65\x73\x73\x65\x72\x20\x47\x65\x6e\x65\x72" \ |
587 | | "\x61\x6c\x20\x50\x75\x62\x6c\x69\x63\x20\x4c\x69\x63\x65\x6e\x73" \ |
588 | | "\x65\x2c\x20\x76\x65\x72\x73\x69\x6f\x6e\x20\x32\x2e\x31\x20\x6f" \ |
589 | | "\x72\x20\x6c\x61\x74\x65\x72\x2e" |
590 | | #define VLC_LICENSE_GPL_2_PLUS \ |
591 | | "\x4c\x69\x63\x65\x6e\x73\x65\x64\x20\x75\x6e\x64\x65\x72\x20\x74" \ |
592 | | "\x68\x65\x20\x74\x65\x72\x6d\x73\x20\x6f\x66\x20\x74\x68\x65\x20" \ |
593 | | "\x47\x4e\x55\x20\x47\x65\x6e\x65\x72\x61\x6c\x20\x50\x75\x62\x6c" \ |
594 | | "\x69\x63\x20\x4c\x69\x63\x65\x6e\x73\x65\x2c\x20\x76\x65\x72\x73" \ |
595 | | "\x69\x6f\x6e\x20\x32\x20\x6f\x72\x20\x6c\x61\x74\x65\x72\x2e" |
596 | | #if defined (LIBVLC_INTERNAL_) |
597 | | # define VLC_MODULE_COPYRIGHT VLC_COPYRIGHT_VIDEOLAN |
598 | | # ifndef VLC_MODULE_LICENSE |
599 | | # define VLC_MODULE_LICENSE VLC_LICENSE_LGPL_2_1_PLUS |
600 | | # endif |
601 | | #endif |
602 | | |
603 | | #ifdef VLC_MODULE_COPYRIGHT |
604 | | # define VLC_COPYRIGHT_EXPORT VLC_META_EXPORT(copyright, VLC_MODULE_COPYRIGHT) |
605 | | #else |
606 | | # define VLC_COPYRIGHT_EXPORT |
607 | | #endif |
608 | | #ifdef VLC_MODULE_LICENSE |
609 | | # define VLC_LICENSE_EXPORT VLC_META_EXPORT(license, VLC_MODULE_LICENSE) |
610 | | #else |
611 | | # define VLC_LICENSE_EXPORT |
612 | | #endif |
613 | | |
614 | | #define VLC_METADATA_EXPORTS \ |
615 | | VLC_API_VERSION_EXPORT \ |
616 | | VLC_COPYRIGHT_EXPORT \ |
617 | | VLC_LICENSE_EXPORT |
618 | | |
619 | | #endif |