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

Externally merge vlc_config_set() and vlc_module_set()

parent f23dc77a
......@@ -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 */
};
/*****************************************************************************
......
......@@ -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
......
......@@ -25,6 +25,8 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#undef vlc_module_set
#undef vlc_config_set
#include <assert.h>
#include <stdarg.h>
......@@ -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;
}
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