Commit b9259bb0 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Merge vlc_submodule_create and vlc_config_create into vlc_plugin_set

parent 51836e3d
......@@ -29,15 +29,16 @@
* This file implements plugin (module) macros used to define a vlc module.
*/
VLC_EXPORT( module_t *, vlc_submodule_create, ( module_t * ) );
VLC_EXPORT( int, vlc_plugin_set, (module_t *, module_config_t *, int, ...) );
VLC_EXPORT( module_config_t *, vlc_config_create, (module_t *, int) );
#define vlc_module_set( mod, ... ) vlc_plugin_set ((mod), NULL, __VA_ARGS__)
#define vlc_config_set( cfg, ... ) vlc_plugin_set (NULL, (cfg), __VA_ARGS__)
enum vlc_module_properties
{
VLC_SUBMODULE_CREATE,
VLC_CONFIG_CREATE,
/* DO NOT EVER REMOVE, INSERT OR REPLACE ANY ITEM! It would break the ABI!
* Append new items at the end ONLY. */
VLC_MODULE_CPU_REQUIREMENT=0x100,
......@@ -191,7 +192,8 @@ enum vlc_module_properties
VLC_METADATA_EXPORTS
#define add_submodule( ) \
p_submodule = vlc_submodule_create( p_module );
if (vlc_plugin_set (p_module, NULL, VLC_SUBMODULE_CREATE, &p_submodule)) \
goto error;
#define add_requirement( cap ) \
if (vlc_module_set (p_module, VLC_MODULE_CPU_REQUIREMENT, \
......@@ -249,7 +251,7 @@ enum vlc_module_properties
*****************************************************************************/
#define add_type_inner( type ) \
p_config = vlc_config_create (p_module, type);
vlc_plugin_set (p_module, NULL, VLC_CONFIG_CREATE, (type), &p_config);
#define add_typedesc_inner( type, text, longtext ) \
add_type_inner( type ) \
......
......@@ -443,7 +443,6 @@ vlc_cond_init
vlc_cond_signal
vlc_cond_timedwait
vlc_cond_wait
vlc_config_create
vlc_control_cancel
vlc_CPU
vlc_error
......@@ -505,7 +504,6 @@ vlc_sendmsg
vlc_strcasestr
vlc_strlcpy
vlc_strtoll
vlc_submodule_create
vlc_testcancel
vlc_thread_create
__vlc_thread_join
......
......@@ -123,7 +123,7 @@ module_t *vlc_submodule_create (module_t *module)
return submodule;
}
module_config_t *vlc_config_create (module_t *module, int type)
static module_config_t *vlc_config_create (module_t *module, int type)
{
unsigned confsize = module->confsize;
module_config_t *tab = module->p_config;
......@@ -161,6 +161,25 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
va_start (ap, propid);
switch (propid)
{
case VLC_SUBMODULE_CREATE:
{
module_t **pp = va_arg (ap, module_t **);
*pp = vlc_submodule_create (module);
if (*pp == NULL)
ret = -1;
break;
}
case VLC_CONFIG_CREATE:
{
int type = va_arg (ap, int);
module_config_t **pp = va_arg (ap, module_config_t **);
*pp = vlc_config_create (module, type);
if (*pp == NULL)
ret = -1;
break;
}
case VLC_MODULE_CPU_REQUIREMENT:
assert (!module->b_submodule);
module->i_cpu |= va_arg (ap, int);
......
......@@ -147,6 +147,7 @@ struct module_t
};
module_t *vlc_module_create (vlc_object_t *);
module_t *vlc_submodule_create (module_t *module);
#define module_InitBank(a) __module_InitBank(VLC_OBJECT(a))
void __module_InitBank ( vlc_object_t * );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment