From 70a56d5650791c01455027322181efcb045b529d Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Tue, 27 Jan 2009 20:42:40 +0200 Subject: [PATCH] Externally merge vlc_config_set() and vlc_module_set() --- include/vlc_plugin.h | 19 ++++++++++--------- src/libvlccore.sym | 3 +-- src/modules/entry.c | 24 +++++++++++++++++------- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/include/vlc_plugin.h b/include/vlc_plugin.h index 2725e3a6ed..d47e1a2907 100644 --- a/include/vlc_plugin.h +++ b/include/vlc_plugin.h @@ -30,15 +30,17 @@ */ VLC_EXPORT( module_t *, vlc_submodule_create, ( module_t * ) ); -VLC_EXPORT( int, vlc_module_set, (module_t *module, int propid, ...) ); -VLC_EXPORT( module_config_t *, vlc_config_create, (module_t *, int type) ); -VLC_EXPORT( int, vlc_config_set, (module_config_t *, int, ...) ); +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 { /* 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, + VLC_MODULE_CPU_REQUIREMENT=0x100, VLC_MODULE_SHORTCUT, VLC_MODULE_CAPABILITY, VLC_MODULE_SCORE, @@ -49,14 +51,11 @@ enum vlc_module_properties VLC_MODULE_SHORTNAME, VLC_MODULE_DESCRIPTION, VLC_MODULE_HELP, -}; + /* Insert new VLC_MODULE_* here */ -enum vlc_config_properties -{ /* DO NOT EVER REMOVE, INSERT OR REPLACE ANY ITEM! It would break the ABI! * Append new items at the end ONLY. */ - - VLC_CONFIG_NAME, + VLC_CONFIG_NAME=0x1000, /* command line name (args=const char *, vlc_callback_t) */ VLC_CONFIG_VALUE, @@ -105,6 +104,8 @@ enum vlc_config_properties VLC_CONFIG_ADD_ACTION, /* add value change callback * (args=const char *, vlc_callback_t, const char *) */ + + /* Insert new VLC_CONFIG_* here */ }; /***************************************************************************** diff --git a/src/libvlccore.sym b/src/libvlccore.sym index a96d9ec91a..176627d0e9 100644 --- a/src/libvlccore.sym +++ b/src/libvlccore.sym @@ -444,7 +444,6 @@ vlc_cond_signal vlc_cond_timedwait vlc_cond_wait vlc_config_create -vlc_config_set vlc_control_cancel vlc_CPU vlc_error @@ -473,7 +472,6 @@ __vlc_list_children vlc_list_release vlc_memcpy vlc_memset -vlc_module_set vlc_mutex_destroy vlc_mutex_init vlc_mutex_init_recursive @@ -491,6 +489,7 @@ __vlc_object_lock __vlc_object_release __vlc_object_set_destructor __vlc_object_unlock +vlc_plugin_set vlc_poll vlc_rand_bytes vlc_recvmsg diff --git a/src/modules/entry.c b/src/modules/entry.c index 028fd10d46..b7828888ff 100644 --- a/src/modules/entry.c +++ b/src/modules/entry.c @@ -25,6 +25,8 @@ #include #include +#undef vlc_module_set +#undef vlc_config_set #include #include @@ -124,12 +126,10 @@ module_t *vlc_submodule_create (module_t *module) } -int vlc_module_set (module_t *module, int propid, ...) +static int vlc_module_set (module_t *module, int propid, va_list ap) { - va_list ap; int ret = VLC_SUCCESS; - va_start (ap, propid); switch (propid) { case VLC_MODULE_CPU_REQUIREMENT: @@ -215,7 +215,6 @@ int vlc_module_set (module_t *module, int propid, ...) ret = VLC_EGENERIC; break; } - va_end (ap); return ret; } @@ -248,13 +247,11 @@ module_config_t *vlc_config_create (module_t *module, int type) return tab + confsize; } -int vlc_config_set (module_config_t *restrict item, int id, ...) +static int vlc_config_set (module_config_t *restrict item, int id, va_list ap) { int ret = -1; - va_list ap; assert (item != NULL); - va_start (ap, id); switch (id) { @@ -499,7 +496,20 @@ int vlc_config_set (module_config_t *restrict item, int id, ...) break; } } + return ret; +} +int vlc_plugin_set (module_t *module, module_config_t *cfg, int id, ...) +{ + va_list ap; + int ret = -1; + + va_start (ap, id); + if (module != NULL) + ret = vlc_module_set (module, id, ap); + else if (cfg != NULL) + ret = vlc_config_set (cfg, id, ap); va_end (ap); + return ret; } -- 2.39.2