#define config_RemoveIntf(a,b) __config_RemoveIntf(VLC_OBJECT(a),b)
#define config_ExistIntf(a,b) __config_ExistIntf(VLC_OBJECT(a),b)
+typedef 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, /* command line name (args=const char *, vlc_callback_t) */
+ VLC_CONFIG_DESC, /* description (args=const char *, const char *) */
+ VLC_CONFIG_VALUE, /* actual value (args=<type>) */
+ VLC_CONFIG_RANGE, /* minimum value (args=<type>, <type>) */
+ VLC_CONFIG_STEP, /* interval value (args=<type>) */
+ VLC_CONFIG_ADVANCED, /* enable advanced flag (args=none) */
+ VLC_CONFIG_VOLATILE, /* don't write variable to storage (args=none) */
+ VLC_CONFIG_PRIVATE, /* hide from user (args=none) */
+} vlc_config_t;
+
+
+VLC_EXPORT( int, vlc_config_set, (module_config_t *, vlc_config_t, ...) );
/*****************************************************************************
* Macros used to build the configuration structure.
#define add_typedesc_inner( type, text, longtext ) \
add_type_inner( type ); \
- p_config[i_config].psz_text = text; \
- p_config[i_config].psz_longtext = longtext
+ vlc_config_set (p_config + i_config, VLC_CONFIG_DESC, \
+ (const char *)(text), (const char *)(longtext))
#define add_typeadv_inner( type, text, longtext, advc ) \
add_typedesc_inner( type, text, longtext ); \
#define add_typename_inner( type, name, text, longtext, advc, cb ) \
add_typeadv_inner( type, text, longtext, advc ); \
- p_config[i_config].psz_name = name; \
- p_config[i_config].pf_callback = cb
+ vlc_config_set (p_config + i_config, VLC_CONFIG_NAME, \
+ (const char *)(name), (vlc_callback_t)(cb))
#define add_string_inner( type, name, text, longtext, advc, cb, v ) \
add_typename_inner( type, name, text, longtext, advc, cb ); \
}
p_module->p_config[i].psz_type = strdupnull (p_orig[i].psz_type);
- p_module->p_config[i].psz_name = strdupnull (p_orig[i].psz_name);
+ p_module->p_config[i].psz_name = p_orig[i].psz_name;
p_module->p_config[i].psz_current = strdupnull (p_orig[i].psz_current);
- p_module->p_config[i].psz_text = _strdupnull (p_orig[i].psz_text);
- p_module->p_config[i].psz_longtext = _strdupnull (p_orig[i].psz_longtext);
+ p_module->p_config[i].psz_text = p_orig[i].psz_text;
+ p_module->p_config[i].psz_longtext = p_orig[i].psz_longtext;
p_module->p_config[i].p_lock = &p_module->object_lock;
#include <vlc/vlc.h>
#include <assert.h>
+#include <stdarg.h>
-#include "modules/modules.h"
+#include "modules.h"
#include "libvlc.h"
-#include "../libvlc.h"
static const char default_name[] = "unnamed";
}
return 0;
}
+
+int vlc_config_set (module_config_t *restrict item, vlc_config_t id, ...)
+{
+ int ret = -1;
+ va_list ap;
+
+ assert (item != NULL);
+ va_start (ap, id);
+
+ switch (id)
+ {
+ case VLC_CONFIG_NAME:
+ {
+ const char *name = va_arg (ap, const char *);
+ vlc_callback_t cb = va_arg (ap, vlc_callback_t);
+
+ assert (name != NULL);
+ item->psz_name = strdup (name);
+ item->pf_callback = cb;
+ break;
+ }
+
+ case VLC_CONFIG_DESC:
+ {
+ const char *text = va_arg (ap, const char *);
+ const char *longtext = va_arg (ap, const char *);
+
+ item->psz_text = text ? strdup (gettext (text)) : NULL;
+ item->psz_longtext = longtext ? strdup (gettext (text)) : NULL;
+ ret = 0;
+ break;
+ }
+
+ case VLC_CONFIG_VALUE:
+ case VLC_CONFIG_RANGE:
+ case VLC_CONFIG_STEP:
+ case VLC_CONFIG_ADVANCED:
+ case VLC_CONFIG_VOLATILE:
+ case VLC_CONFIG_PRIVATE:
+ break;
+ }
+
+ va_end (ap);
+ return ret;
+}