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

Remove config change callback

This was only used by {alsa,oss}-audio-device and not semantically
correct anyway. If we deem that this is useful, we should register
a callback on the corresponding variables and change the variables
from the UI, not the process-wide configuration.
parent 4d63bf16
...@@ -155,9 +155,6 @@ struct module_config_t ...@@ -155,9 +155,6 @@ struct module_config_t
module_value_t min; module_value_t min;
module_value_t max; module_value_t max;
/* Function to call when commiting a change */
vlc_callback_t pf_callback;
/* Values list */ /* Values list */
char ** ppsz_list; /* List of possible values for the option */ char ** ppsz_list; /* List of possible values for the option */
int *pi_list; /* Idem for integers */ int *pi_list; /* Idem for integers */
......
...@@ -58,7 +58,7 @@ enum vlc_module_properties ...@@ -58,7 +58,7 @@ enum vlc_module_properties
/* DO NOT EVER REMOVE, INSERT OR REPLACE ANY ITEM! It would break the ABI! /* DO NOT EVER REMOVE, INSERT OR REPLACE ANY ITEM! It would break the ABI!
* Append new items at the end ONLY. */ * Append new items at the end ONLY. */
VLC_CONFIG_NAME=0x1000, VLC_CONFIG_NAME=0x1000,
/* command line name (args=const char *, vlc_callback_t) */ /* command line name (args=const char *) */
VLC_CONFIG_VALUE, VLC_CONFIG_VALUE,
/* actual value (args=int/double/const char *) */ /* actual value (args=int/double/const char *) */
......
...@@ -257,7 +257,6 @@ void config_PutPsz( vlc_object_t *p_this, ...@@ -257,7 +257,6 @@ void config_PutPsz( vlc_object_t *p_this,
const char *psz_name, const char *psz_value ) const char *psz_name, const char *psz_value )
{ {
module_config_t *p_config; module_config_t *p_config;
vlc_value_t oldval;
p_config = config_FindConfig( p_this, psz_name ); p_config = config_FindConfig( p_this, psz_name );
...@@ -275,30 +274,19 @@ void config_PutPsz( vlc_object_t *p_this, ...@@ -275,30 +274,19 @@ void config_PutPsz( vlc_object_t *p_this,
return; return;
} }
char *str; char *str, *oldstr;
if ((psz_value != NULL) && *psz_value) if ((psz_value != NULL) && *psz_value)
str = strdup (psz_value); str = strdup (psz_value);
else else
str = NULL; str = NULL;
vlc_rwlock_wrlock (&config_lock); vlc_rwlock_wrlock (&config_lock);
/* backup old value */ oldstr = (char *)p_config->value.psz;
oldval.psz_string = (char *)p_config->value.psz;
p_config->value.psz = str; p_config->value.psz = str;
p_config->b_dirty = true; p_config->b_dirty = true;
vlc_rwlock_unlock (&config_lock); vlc_rwlock_unlock (&config_lock);
if( p_config->pf_callback ) free (oldstr);
{
vlc_value_t val;
val.psz_string = (char *)psz_value;
p_config->pf_callback( p_this, psz_name, oldval, val, NULL );
}
/* free old string */
free( oldval.psz_string );
} }
#undef config_PutInt #undef config_PutInt
...@@ -313,7 +301,6 @@ void config_PutInt( vlc_object_t *p_this, const char *psz_name, ...@@ -313,7 +301,6 @@ void config_PutInt( vlc_object_t *p_this, const char *psz_name,
int64_t i_value ) int64_t i_value )
{ {
module_config_t *p_config; module_config_t *p_config;
vlc_value_t oldval;
p_config = config_FindConfig( p_this, psz_name ); p_config = config_FindConfig( p_this, psz_name );
...@@ -336,21 +323,9 @@ void config_PutInt( vlc_object_t *p_this, const char *psz_name, ...@@ -336,21 +323,9 @@ void config_PutInt( vlc_object_t *p_this, const char *psz_name,
i_value = p_config->max.i; i_value = p_config->max.i;
vlc_rwlock_wrlock (&config_lock); vlc_rwlock_wrlock (&config_lock);
/* backup old value */
oldval.i_int = p_config->value.i;
p_config->value.i = i_value; p_config->value.i = i_value;
p_config->b_dirty = true; p_config->b_dirty = true;
vlc_rwlock_unlock (&config_lock); vlc_rwlock_unlock (&config_lock);
if( p_config->pf_callback )
{
vlc_value_t val;
val.i_int = i_value;
p_config->pf_callback( p_this, psz_name, oldval, val,
p_config->p_callback_data );
}
} }
#undef config_PutFloat #undef config_PutFloat
...@@ -364,7 +339,6 @@ void config_PutFloat( vlc_object_t *p_this, ...@@ -364,7 +339,6 @@ void config_PutFloat( vlc_object_t *p_this,
const char *psz_name, float f_value ) const char *psz_name, float f_value )
{ {
module_config_t *p_config; module_config_t *p_config;
vlc_value_t oldval;
p_config = config_FindConfig( p_this, psz_name ); p_config = config_FindConfig( p_this, psz_name );
...@@ -390,21 +364,9 @@ void config_PutFloat( vlc_object_t *p_this, ...@@ -390,21 +364,9 @@ void config_PutFloat( vlc_object_t *p_this,
f_value = p_config->max.f; f_value = p_config->max.f;
vlc_rwlock_wrlock (&config_lock); vlc_rwlock_wrlock (&config_lock);
/* backup old value */
oldval.f_float = p_config->value.f;
p_config->value.f = f_value; p_config->value.f = f_value;
p_config->b_dirty = true; p_config->b_dirty = true;
vlc_rwlock_unlock (&config_lock); vlc_rwlock_unlock (&config_lock);
if( p_config->pf_callback )
{
vlc_value_t val;
val.f_float = f_value;
p_config->pf_callback( p_this, psz_name, oldval, val,
p_config->p_callback_data );
}
} }
static int confcmp (const void *a, const void *b) static int confcmp (const void *a, const void *b)
......
...@@ -59,7 +59,7 @@ static int CacheLoadConfig ( module_t *, FILE * ); ...@@ -59,7 +59,7 @@ static int CacheLoadConfig ( module_t *, FILE * );
/* Sub-version number /* Sub-version number
* (only used to avoid breakage in dev version when cache structure changes) */ * (only used to avoid breakage in dev version when cache structure changes) */
#define CACHE_SUBVERSION_NUM 11 #define CACHE_SUBVERSION_NUM 12
/* Format string for the cache filename */ /* Format string for the cache filename */
#define CACHENAME_FORMAT \ #define CACHENAME_FORMAT \
...@@ -326,16 +326,6 @@ void CacheLoad( vlc_object_t *p_this, module_bank_t *p_bank, const char *dir ) ...@@ -326,16 +326,6 @@ void CacheLoad( vlc_object_t *p_this, module_bank_t *p_bank, const char *dir )
} }
/* This function should never be called.
* It is only used as a non-NULL vlc_callback_t value for comparison. */
static int dummy_callback (vlc_object_t *obj, const char *name,
vlc_value_t oldval, vlc_value_t newval, void *data)
{
(void) obj; (void)name; (void)oldval; (void)newval; (void)data;
assert (0);
}
static int CacheLoadConfig( module_t *p_module, FILE *file ) static int CacheLoadConfig( module_t *p_module, FILE *file )
{ {
uint32_t i_lines; uint32_t i_lines;
...@@ -441,11 +431,6 @@ static int CacheLoadConfig( module_t *p_module, FILE *file ) ...@@ -441,11 +431,6 @@ static int CacheLoadConfig( module_t *p_module, FILE *file )
LOAD_STRING( p_module->p_config[i].ppsz_action_text[j] ); LOAD_STRING( p_module->p_config[i].ppsz_action_text[j] );
} }
} }
bool has_callback;
LOAD_IMMEDIATE( has_callback );
if (has_callback)
p_module->p_config[i].pf_callback = dummy_callback;
} }
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -669,9 +654,6 @@ static int CacheSaveConfig (FILE *file, const module_t *p_module) ...@@ -669,9 +654,6 @@ static int CacheSaveConfig (FILE *file, const module_t *p_module)
for (int j = 0; j < p_module->p_config[i].i_action; j++) for (int j = 0; j < p_module->p_config[i].i_action; j++)
SAVE_STRING( p_module->p_config[i].ppsz_action_text[j] ); SAVE_STRING( p_module->p_config[i].ppsz_action_text[j] );
bool has_callback = p_module->p_config[i].pf_callback != NULL;
SAVE_IMMEDIATE( has_callback );
} }
return 0; return 0;
......
...@@ -259,11 +259,9 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...) ...@@ -259,11 +259,9 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
case VLC_CONFIG_NAME: case VLC_CONFIG_NAME:
{ {
const char *name = va_arg (ap, const char *); const char *name = va_arg (ap, const char *);
vlc_callback_t cb = va_arg (ap, vlc_callback_t);
assert (name != NULL); assert (name != NULL);
item->psz_name = strdup (name); item->psz_name = strdup (name);
item->pf_callback = cb;
break; break;
} }
......
...@@ -956,7 +956,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, module_bank_t *p_bank, ...@@ -956,7 +956,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, module_bank_t *p_bank,
for( p_item = p_module->p_config, p_end = p_item + p_module->confsize; for( p_item = p_module->p_config, p_end = p_item + p_module->confsize;
p_item < p_end; p_item++ ) p_item < p_end; p_item++ )
{ {
if( p_item->pf_callback || p_item->i_action ) if( p_item->i_action )
{ {
p_module = AllocatePlugin( p_this, psz_file ); p_module = AllocatePlugin( p_this, psz_file );
break; break;
......
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