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

Migrate module, module_list and obsolete_* to vlc_config_set

parent f756ebd7
......@@ -235,15 +235,39 @@ 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_ADVANCED, /* enable advanced flag (args=none) */
VLC_CONFIG_VOLATILE, /* don't write variable to storage (args=none) */
VLC_CONFIG_PERSISTENT, /* always write variable to storage (args=none) */
VLC_CONFIG_RESTART, /* restart required to apply value change (args=none) */
VLC_CONFIG_PRIVATE, /* hide from user (args=none) */
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=int/double/const char *) */
VLC_CONFIG_RANGE,
/* minimum value (args=int/double/const char * twice) */
VLC_CONFIG_ADVANCED,
/* enable advanced flag (args=none) */
VLC_CONFIG_VOLATILE,
/* don't write variable to storage (args=none) */
VLC_CONFIG_PERSISTENT,
/* always write variable to storage (args=none) */
VLC_CONFIG_RESTART,
/* restart required to apply value change (args=none) */
VLC_CONFIG_PRIVATE,
/* hide from user (args=none) */
VLC_CONFIG_REMOVED,
/* tag as no longer supported (args=none) */
VLC_CONFIG_CAPABILITY,
/* capability for a module or list thereof (args=const char*) */
} vlc_config_t;
......@@ -334,7 +358,8 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, vlc_config_t, ...) );
#define add_module( name, psz_caps, value, p_callback, text, longtext, advc ) \
add_string_inner( CONFIG_ITEM_MODULE, name, text, longtext, advc, p_callback, value ); \
p_config[i_config].psz_type = psz_caps
vlc_config_set (p_config + i_config, VLC_CONFIG_CAPABILITY, \
(const char *)(psz_caps))
#define add_module_cat( name, i_subcategory, value, p_callback, text, longtext, advc ) \
add_string_inner( CONFIG_ITEM_MODULE_CAT, name, text, longtext, advc, p_callback, value ); \
......@@ -342,7 +367,8 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, vlc_config_t, ...) );
#define add_module_list( name, psz_caps, value, p_callback, text, longtext, advc ) \
add_string_inner( CONFIG_ITEM_MODULE_LIST, name, text, longtext, advc, p_callback, value ); \
p_config[i_config].psz_type = psz_caps
vlc_config_set (p_config + i_config, VLC_CONFIG_CAPABILITY, \
(const char *)(psz_caps))
#define add_module_list_cat( name, i_subcategory, value, p_callback, text, longtext, advc ) \
add_string_inner( CONFIG_ITEM_MODULE_LIST_CAT, name, text, longtext, advc, p_callback, value ); \
......@@ -386,7 +412,7 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, vlc_config_t, ...) );
add_type_inner( type ); \
vlc_config_set (p_config + i_config, VLC_CONFIG_NAME, \
(const char *)(name), (vlc_callback_t)NULL); \
p_config[ i_config ].psz_current = "SUPPRESSED"
vlc_config_set (p_config + i_config, VLC_CONFIG_REMOVED)
#define add_obsolete_bool( name ) \
add_obsolete_inner( name, CONFIG_ITEM_BOOL )
......
......@@ -540,9 +540,9 @@ int config_Duplicate( module_t *p_module, const module_config_t *p_orig,
p_module->p_config[i].saved.psz = NULL;
}
p_module->p_config[i].psz_type = strdupnull (p_orig[i].psz_type);
p_module->p_config[i].psz_type = p_orig[i].psz_type;
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_current = p_orig[i].psz_current;
p_module->p_config[i].psz_text = p_orig[i].psz_text;
p_module->p_config[i].psz_longtext = p_orig[i].psz_longtext;
......@@ -628,7 +628,6 @@ void config_Free( module_t *p_module )
free( (char*) p_item->psz_type );
free( (char*) p_item->psz_name );
free( (char*) p_item->psz_current );
free( (char*) p_item->psz_text );
free( (char*) p_item->psz_longtext );
......
......@@ -259,6 +259,19 @@ int vlc_config_set (module_config_t *restrict item, vlc_config_t id, ...)
item->b_internal = VLC_TRUE;
ret = 0;
break;
case VLC_CONFIG_REMOVED:
item->psz_current = "SUPPRESSED";
ret = 0;
break;
case VLC_CONFIG_CAPABILITY:
{
const char *cap = va_arg (ap, const char *);
item->psz_type = cap ? strdup (cap) : NULL;
ret = 0;
break;
}
}
va_end (ap);
......
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