00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef LIBVLC_MODULES_MACROS_H
00025 # define LIBVLC_MODULES_MACROS_H 1
00026
00027
00028
00029
00030
00031
00032 enum vlc_module_properties
00033 {
00034 VLC_MODULE_CREATE,
00035 VLC_CONFIG_CREATE,
00036
00037
00038
00039 VLC_MODULE_CPU_REQUIREMENT=0x100,
00040 VLC_MODULE_SHORTCUT,
00041 VLC_MODULE_CAPABILITY,
00042 VLC_MODULE_SCORE,
00043 VLC_MODULE_CB_OPEN,
00044 VLC_MODULE_CB_CLOSE,
00045 VLC_MODULE_NO_UNLOAD,
00046 VLC_MODULE_NAME,
00047 VLC_MODULE_SHORTNAME,
00048 VLC_MODULE_DESCRIPTION,
00049 VLC_MODULE_HELP,
00050 VLC_MODULE_TEXTDOMAIN,
00051
00052
00053
00054
00055 VLC_CONFIG_NAME=0x1000,
00056
00057
00058 VLC_CONFIG_VALUE,
00059
00060
00061 VLC_CONFIG_RANGE,
00062
00063
00064 VLC_CONFIG_ADVANCED,
00065
00066
00067 VLC_CONFIG_VOLATILE,
00068
00069
00070 VLC_CONFIG_PERSISTENT_OBSOLETE,
00071
00072
00073 VLC_CONFIG_PRIVATE,
00074
00075
00076 VLC_CONFIG_REMOVED,
00077
00078
00079 VLC_CONFIG_CAPABILITY,
00080
00081
00082 VLC_CONFIG_SHORTCUT,
00083
00084
00085 VLC_CONFIG_OLDNAME_OBSOLETE,
00086
00087
00088 VLC_CONFIG_SAFE,
00089
00090
00091 VLC_CONFIG_DESC,
00092
00093
00094 VLC_CONFIG_LIST,
00095
00096
00097
00098 VLC_CONFIG_ADD_ACTION,
00099
00100
00101
00102
00103 };
00104
00105
00106 #define CONFIG_HINT_CATEGORY 0x02
00107 #define CONFIG_HINT_SUBCATEGORY 0x03
00108 #define CONFIG_HINT_SUBCATEGORY_END 0x04
00109 #define CONFIG_HINT_USAGE 0x05
00110
00111 #define CONFIG_CATEGORY 0x06
00112 #define CONFIG_SUBCATEGORY 0x07
00113 #define CONFIG_SECTION 0x08
00114
00115
00116 #define CONFIG_ITEM_FLOAT 0x20
00117 #define CONFIG_ITEM_INTEGER 0x40
00118 #define CONFIG_ITEM_RGB 0x41
00119 #define CONFIG_ITEM_BOOL 0x60
00120 #define CONFIG_ITEM_STRING 0x80
00121 #define CONFIG_ITEM_PASSWORD 0x81
00122 #define CONFIG_ITEM_KEY 0x82
00123 #define CONFIG_ITEM_MODULE 0x84
00124 #define CONFIG_ITEM_MODULE_CAT 0x85
00125 #define CONFIG_ITEM_MODULE_LIST 0x86
00126 #define CONFIG_ITEM_MODULE_LIST_CAT 0x87
00127 #define CONFIG_ITEM_LOADFILE 0x8C
00128 #define CONFIG_ITEM_SAVEFILE 0x8D
00129 #define CONFIG_ITEM_DIRECTORY 0x8E
00130 #define CONFIG_ITEM_FONT 0x8F
00131
00132 #define CONFIG_ITEM(x) (((x) & ~0xF) != 0)
00133
00134
00135 #define CAT_INTERFACE 1
00136 #define SUBCAT_INTERFACE_GENERAL 101
00137 #define SUBCAT_INTERFACE_MAIN 102
00138 #define SUBCAT_INTERFACE_CONTROL 103
00139 #define SUBCAT_INTERFACE_HOTKEYS 104
00140
00141 #define CAT_AUDIO 2
00142 #define SUBCAT_AUDIO_GENERAL 201
00143 #define SUBCAT_AUDIO_AOUT 202
00144 #define SUBCAT_AUDIO_AFILTER 203
00145 #define SUBCAT_AUDIO_VISUAL 204
00146 #define SUBCAT_AUDIO_MISC 205
00147
00148 #define CAT_VIDEO 3
00149 #define SUBCAT_VIDEO_GENERAL 301
00150 #define SUBCAT_VIDEO_VOUT 302
00151 #define SUBCAT_VIDEO_VFILTER 303
00152 #define SUBCAT_VIDEO_TEXT 304
00153 #define SUBCAT_VIDEO_SUBPIC 305
00154 #define SUBCAT_VIDEO_VFILTER2 306
00155
00156 #define CAT_INPUT 4
00157 #define SUBCAT_INPUT_GENERAL 401
00158 #define SUBCAT_INPUT_ACCESS 402
00159 #define SUBCAT_INPUT_DEMUX 403
00160 #define SUBCAT_INPUT_VCODEC 404
00161 #define SUBCAT_INPUT_ACODEC 405
00162 #define SUBCAT_INPUT_SCODEC 406
00163 #define SUBCAT_INPUT_STREAM_FILTER 407
00164
00165 #define CAT_SOUT 5
00166 #define SUBCAT_SOUT_GENERAL 501
00167 #define SUBCAT_SOUT_STREAM 502
00168 #define SUBCAT_SOUT_MUX 503
00169 #define SUBCAT_SOUT_ACO 504
00170 #define SUBCAT_SOUT_PACKETIZER 505
00171 #define SUBCAT_SOUT_SAP 506
00172 #define SUBCAT_SOUT_VOD 507
00173
00174 #define CAT_ADVANCED 6
00175 #define SUBCAT_ADVANCED_CPU 601
00176 #define SUBCAT_ADVANCED_MISC 602
00177 #define SUBCAT_ADVANCED_NETWORK 603
00178 #define SUBCAT_ADVANCED_XML 604
00179
00180 #define CAT_PLAYLIST 7
00181 #define SUBCAT_PLAYLIST_GENERAL 701
00182 #define SUBCAT_PLAYLIST_SD 702
00183 #define SUBCAT_PLAYLIST_EXPORT 703
00184
00185 #define CAT_OSD 8
00186 #define SUBCAT_OSD_IMPORT 801
00187
00188
00189
00190
00191
00192 # define MODULE_SYMBOL 2_1_0a
00193 # define MODULE_SUFFIX "__2_1_0a"
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208 #define CONCATENATE( y, z ) CRUDE_HACK( y, z )
00209 #define CRUDE_HACK( y, z ) y##__##z
00210
00211
00212
00213 #ifdef __PLUGIN__
00214 # define __VLC_SYMBOL( symbol ) CONCATENATE( symbol, MODULE_SYMBOL )
00215 #else
00216 # define __VLC_SYMBOL( symbol ) CONCATENATE( symbol, MODULE_NAME )
00217 #endif
00218
00219 #define CDECL_SYMBOL
00220 #if defined (__PLUGIN__)
00221 # if defined (WIN32)
00222 # define DLL_SYMBOL __declspec(dllexport)
00223 # undef CDECL_SYMBOL
00224 # define CDECL_SYMBOL __cdecl
00225 # elif VLC_GCC_VERSION(4,0)
00226 # define DLL_SYMBOL __attribute__((visibility("default")))
00227 # else
00228 # define DLL_SYMBOL
00229 # endif
00230 #else
00231 # define DLL_SYMBOL
00232 #endif
00233
00234 #if defined( __cplusplus )
00235 # define EXTERN_SYMBOL extern "C"
00236 #else
00237 # define EXTERN_SYMBOL
00238 #endif
00239
00240 typedef int (*vlc_set_cb) (void *, void *, int, ...);
00241
00242 #define vlc_plugin_set(...) vlc_set (opaque, NULL, __VA_ARGS__)
00243 #define vlc_module_set(...) vlc_set (opaque, module, __VA_ARGS__)
00244 #define vlc_config_set(...) vlc_set (opaque, config, __VA_ARGS__)
00245
00246
00247
00248
00249
00250
00251
00252 #define vlc_module_begin() \
00253 EXTERN_SYMBOL DLL_SYMBOL \
00254 int CDECL_SYMBOL __VLC_SYMBOL(vlc_entry) (vlc_set_cb, void *); \
00255 EXTERN_SYMBOL DLL_SYMBOL \
00256 int CDECL_SYMBOL __VLC_SYMBOL(vlc_entry) (vlc_set_cb vlc_set, void *opaque) \
00257 { \
00258 module_t *module; \
00259 module_config_t *config = NULL; \
00260 if (vlc_plugin_set (VLC_MODULE_CREATE, &module)) \
00261 goto error; \
00262 if (vlc_module_set (VLC_MODULE_NAME, (MODULE_STRING))) \
00263 goto error;
00264
00265 #define vlc_module_end() \
00266 (void) config; \
00267 return 0; \
00268 error: \
00269 return -1; \
00270 } \
00271 VLC_METADATA_EXPORTS
00272
00273 #define add_submodule( ) \
00274 if (vlc_plugin_set (VLC_MODULE_CREATE, &module)) \
00275 goto error;
00276
00277 #define add_shortcut( ... ) \
00278 { \
00279 const char *shortcuts[] = { __VA_ARGS__ }; \
00280 if (vlc_module_set (VLC_MODULE_SHORTCUT, \
00281 sizeof(shortcuts)/sizeof(shortcuts[0]), shortcuts)) \
00282 goto error; \
00283 }
00284
00285 #define set_shortname( shortname ) \
00286 if (vlc_module_set (VLC_MODULE_SHORTNAME, (const char *)(shortname))) \
00287 goto error;
00288
00289 #define set_description( desc ) \
00290 if (vlc_module_set (VLC_MODULE_DESCRIPTION, (const char *)(desc))) \
00291 goto error;
00292
00293 #define set_help( help ) \
00294 if (vlc_module_set (VLC_MODULE_HELP, (const char *)(help))) \
00295 goto error;
00296
00297 #define set_capability( cap, score ) \
00298 if (vlc_module_set (VLC_MODULE_CAPABILITY, (const char *)(cap)) \
00299 || vlc_module_set (VLC_MODULE_SCORE, (int)(score))) \
00300 goto error;
00301
00302 #define set_callbacks( activate, deactivate ) \
00303 if (vlc_module_set (VLC_MODULE_CB_OPEN, activate) \
00304 || vlc_module_set (VLC_MODULE_CB_CLOSE, deactivate)) \
00305 goto error;
00306
00307 #define cannot_unload_broken_library( ) \
00308 if (vlc_module_set (VLC_MODULE_NO_UNLOAD)) \
00309 goto error;
00310
00311 #define set_text_domain( dom ) \
00312 if (vlc_plugin_set (VLC_MODULE_TEXTDOMAIN, (dom))) \
00313 goto error;
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328 #define add_type_inner( type ) \
00329 vlc_plugin_set (VLC_CONFIG_CREATE, (type), &config);
00330
00331 #define add_typedesc_inner( type, text, longtext ) \
00332 add_type_inner( type ) \
00333 vlc_config_set (VLC_CONFIG_DESC, \
00334 (const char *)(text), (const char *)(longtext));
00335
00336 #define add_typeadv_inner( type, text, longtext, advc ) \
00337 add_typedesc_inner( type, text, longtext ) \
00338 if (advc) vlc_config_set (VLC_CONFIG_ADVANCED);
00339
00340 #define add_typename_inner( type, name, text, longtext, advc ) \
00341 add_typeadv_inner( type, text, longtext, advc ) \
00342 vlc_config_set (VLC_CONFIG_NAME, (const char *)(name));
00343
00344 #define add_string_inner( type, name, text, longtext, advc, v ) \
00345 add_typename_inner( type, name, text, longtext, advc ) \
00346 vlc_config_set (VLC_CONFIG_VALUE, (const char *)(v));
00347
00348 #define add_int_inner( type, name, text, longtext, advc, v ) \
00349 add_typename_inner( type, name, text, longtext, advc ) \
00350 vlc_config_set (VLC_CONFIG_VALUE, (int64_t)(v));
00351
00352
00353 #define set_category( i_id ) \
00354 add_type_inner( CONFIG_CATEGORY ) \
00355 vlc_config_set (VLC_CONFIG_VALUE, (int64_t)(i_id));
00356
00357 #define set_subcategory( i_id ) \
00358 add_type_inner( CONFIG_SUBCATEGORY ) \
00359 vlc_config_set (VLC_CONFIG_VALUE, (int64_t)(i_id));
00360
00361 #define set_section( text, longtext ) \
00362 add_typedesc_inner( CONFIG_SECTION, text, longtext )
00363
00364 #define add_category_hint( text, longtext, advc ) \
00365 add_typeadv_inner( CONFIG_HINT_CATEGORY, text, longtext, advc )
00366
00367 #define add_subcategory_hint( text, longtext ) \
00368 add_typedesc_inner( CONFIG_HINT_SUBCATEGORY, text, longtext )
00369
00370 #define end_subcategory_hint \
00371 add_type_inner( CONFIG_HINT_SUBCATEGORY_END )
00372
00373 #define add_usage_hint( text ) \
00374 add_typedesc_inner( CONFIG_HINT_USAGE, text, NULL )
00375
00376 #define add_string( name, value, text, longtext, advc ) \
00377 add_string_inner( CONFIG_ITEM_STRING, name, text, longtext, advc, \
00378 value )
00379
00380 #define add_password( name, value, text, longtext, advc ) \
00381 add_string_inner( CONFIG_ITEM_PASSWORD, name, text, longtext, advc, \
00382 value )
00383
00384 #define add_loadfile( name, value, text, longtext, advc ) \
00385 add_string_inner( CONFIG_ITEM_LOADFILE, name, text, longtext, advc, \
00386 value )
00387
00388 #define add_savefile( name, value, text, longtext, advc ) \
00389 add_string_inner( CONFIG_ITEM_SAVEFILE, name, text, longtext, advc, \
00390 value )
00391
00392 #define add_directory( name, value, text, longtext, advc ) \
00393 add_string_inner( CONFIG_ITEM_DIRECTORY, name, text, longtext, advc, \
00394 value )
00395
00396 #define add_font( name, value, text, longtext, advc )\
00397 add_string_inner( CONFIG_ITEM_FONT, name, text, longtext, advc, \
00398 value )
00399
00400 #define add_module( name, psz_caps, value, text, longtext, advc ) \
00401 add_string_inner( CONFIG_ITEM_MODULE, name, text, longtext, advc, \
00402 value ) \
00403 vlc_config_set (VLC_CONFIG_CAPABILITY, (const char *)(psz_caps));
00404
00405 #define add_module_list( name, psz_caps, value, text, longtext, advc ) \
00406 add_string_inner( CONFIG_ITEM_MODULE_LIST, name, text, longtext, advc, \
00407 value ) \
00408 vlc_config_set (VLC_CONFIG_CAPABILITY, (const char *)(psz_caps));
00409
00410 #ifndef __PLUGIN__
00411 #define add_module_cat( name, i_subcategory, value, text, longtext, advc ) \
00412 add_string_inner( CONFIG_ITEM_MODULE_CAT, name, text, longtext, advc, \
00413 value ) \
00414 change_integer_range (i_subcategory , 0);
00415
00416 #define add_module_list_cat( name, i_subcategory, value, text, longtext, advc ) \
00417 add_string_inner( CONFIG_ITEM_MODULE_LIST_CAT, name, text, longtext, \
00418 advc, value ) \
00419 change_integer_range (i_subcategory , 0);
00420 #endif
00421
00422 #define add_integer( name, value, text, longtext, advc ) \
00423 add_int_inner( CONFIG_ITEM_INTEGER, name, text, longtext, advc, value )
00424
00425 #define add_rgb( name, value, text, longtext, advc ) \
00426 add_int_inner( CONFIG_ITEM_RGB, name, text, longtext, advc, value ) \
00427 change_integer_range( 0, 0xFFFFFF )
00428
00429 #define add_key( name, value, text, longtext, advc ) \
00430 add_string_inner( CONFIG_ITEM_KEY, "global-" name, text, longtext, advc, \
00431 KEY_UNSET ) \
00432 add_string_inner( CONFIG_ITEM_KEY, name, text, longtext, advc, value )
00433
00434 #define add_integer_with_range( name, value, i_min, i_max, text, longtext, advc ) \
00435 add_integer( name, value, text, longtext, advc ) \
00436 change_integer_range( i_min, i_max )
00437
00438 #define add_float( name, v, text, longtext, advc ) \
00439 add_typename_inner( CONFIG_ITEM_FLOAT, name, text, longtext, advc ) \
00440 vlc_config_set (VLC_CONFIG_VALUE, (double)(v));
00441
00442 #define add_float_with_range( name, value, f_min, f_max, text, longtext, advc ) \
00443 add_float( name, value, text, longtext, advc ) \
00444 change_float_range( f_min, f_max )
00445
00446 #define add_bool( name, v, text, longtext, advc ) \
00447 add_typename_inner( CONFIG_ITEM_BOOL, name, text, longtext, advc ) \
00448 if (v) vlc_config_set (VLC_CONFIG_VALUE, (int64_t)true);
00449
00450
00451 #define add_obsolete_inner( name, type ) \
00452 add_type_inner( type ) \
00453 vlc_config_set (VLC_CONFIG_NAME, (const char *)(name)); \
00454 vlc_config_set (VLC_CONFIG_REMOVED);
00455
00456 #define add_obsolete_bool( name ) \
00457 add_obsolete_inner( name, CONFIG_ITEM_BOOL )
00458
00459 #define add_obsolete_integer( name ) \
00460 add_obsolete_inner( name, CONFIG_ITEM_INTEGER )
00461
00462 #define add_obsolete_float( name ) \
00463 add_obsolete_inner( name, CONFIG_ITEM_FLOAT )
00464
00465 #define add_obsolete_string( name ) \
00466 add_obsolete_inner( name, CONFIG_ITEM_STRING )
00467
00468
00469
00470 #define change_short( ch ) \
00471 vlc_config_set (VLC_CONFIG_SHORTCUT, (int)(ch));
00472
00473 #define change_string_list( list, list_text, list_update_func ) \
00474 vlc_config_set (VLC_CONFIG_LIST, \
00475 (size_t)(sizeof (list) / sizeof (char *)), \
00476 (const char *const *)(list), \
00477 (const char *const *)(list_text), \
00478 (vlc_callback_t)(list_update_func));
00479
00480 #define change_integer_list( list, list_text ) \
00481 vlc_config_set (VLC_CONFIG_LIST, \
00482 (size_t)(sizeof (list) / sizeof (int)), \
00483 (const int *)(list), \
00484 (const char *const *)(list_text), \
00485 (vlc_callback_t)(NULL));
00486
00487 #define change_integer_range( minv, maxv ) \
00488 vlc_config_set (VLC_CONFIG_RANGE, (int64_t)(minv), (int64_t)(maxv));
00489
00490 #define change_float_range( minv, maxv ) \
00491 vlc_config_set (VLC_CONFIG_RANGE, (double)(minv), (double)(maxv));
00492
00493 #define change_action_add( pf_action, text ) \
00494 vlc_config_set (VLC_CONFIG_ADD_ACTION, \
00495 (vlc_callback_t)(pf_action), (const char *)(text));
00496
00497
00498 #define change_private() \
00499 vlc_config_set (VLC_CONFIG_PRIVATE);
00500
00501
00502 #define change_volatile() \
00503 change_private() \
00504 vlc_config_set (VLC_CONFIG_VOLATILE);
00505
00506 #define change_safe() \
00507 vlc_config_set (VLC_CONFIG_SAFE);
00508
00509
00510 #define VLC_META_EXPORT( name, value ) \
00511 EXTERN_SYMBOL DLL_SYMBOL const char * CDECL_SYMBOL \
00512 __VLC_SYMBOL(vlc_entry_ ## name) (void); \
00513 EXTERN_SYMBOL DLL_SYMBOL const char * CDECL_SYMBOL \
00514 __VLC_SYMBOL(vlc_entry_ ## name) (void) \
00515 { \
00516 return value; \
00517 }
00518
00519 #if defined (__LIBVLC__)
00520 # define VLC_COPYRIGHT_EXPORT VLC_META_EXPORT (copyright, \
00521 "\x43\x6f\x70\x79\x72\x69\x67\x68\x74\x20\x28\x43\x29\x20\x74\x68" \
00522 "\x65\x20\x56\x69\x64\x65\x6f\x4c\x41\x4e\x20\x56\x4c\x43\x20\x6d" \
00523 "\x65\x64\x69\x61\x20\x70\x6c\x61\x79\x65\x72\x20\x64\x65\x76\x65" \
00524 "\x6c\x6f\x70\x65\x72\x73" )
00525 #elif !defined (VLC_COPYRIGHT_EXPORT)
00526 # define VLC_COPYRIGHT_EXPORT
00527 #endif
00528 #define VLC_LICENSE_EXPORT VLC_META_EXPORT (license, \
00529 "\x4c\x69\x63\x65\x6e\x73\x65\x64\x20\x75\x6e\x64\x65\x72\x20\x74" \
00530 "\x68\x65\x20\x74\x65\x72\x6d\x73\x20\x6f\x66\x20\x74\x68\x65\x20" \
00531 "\x47\x4e\x55\x20\x47\x65\x6e\x65\x72\x61\x6c\x20\x50\x75\x62\x6c" \
00532 "\x69\x63\x20\x4c\x69\x63\x65\x6e\x73\x65\x2c\x20\x76\x65\x72\x73" \
00533 "\x69\x6f\x6e\x20\x32\x20\x6f\x72\x20\x6c\x61\x74\x65\x72\x2e" )
00534
00535 #define VLC_METADATA_EXPORTS \
00536 VLC_COPYRIGHT_EXPORT \
00537 VLC_LICENSE_EXPORT
00538
00539 #endif