1
mirror of https://code.videolan.org/videolan/vlc synced 2024-09-16 16:02:54 +02:00

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.
This commit is contained in:
Rémi Denis-Courmont 2010-10-22 19:45:36 +03:00
parent 4d63bf16fd
commit 3c659c5390
6 changed files with 6 additions and 67 deletions

View File

@ -155,9 +155,6 @@ struct module_config_t
module_value_t min;
module_value_t max;
/* Function to call when commiting a change */
vlc_callback_t pf_callback;
/* Values list */
char ** ppsz_list; /* List of possible values for the option */
int *pi_list; /* Idem for integers */

View File

@ -58,7 +58,7 @@ 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_CONFIG_NAME=0x1000,
/* command line name (args=const char *, vlc_callback_t) */
/* command line name (args=const char *) */
VLC_CONFIG_VALUE,
/* actual value (args=int/double/const char *) */

View File

@ -257,7 +257,6 @@ void config_PutPsz( vlc_object_t *p_this,
const char *psz_name, const char *psz_value )
{
module_config_t *p_config;
vlc_value_t oldval;
p_config = config_FindConfig( p_this, psz_name );
@ -275,30 +274,19 @@ void config_PutPsz( vlc_object_t *p_this,
return;
}
char *str;
char *str, *oldstr;
if ((psz_value != NULL) && *psz_value)
str = strdup (psz_value);
else
str = NULL;
vlc_rwlock_wrlock (&config_lock);
/* backup old value */
oldval.psz_string = (char *)p_config->value.psz;
oldstr = (char *)p_config->value.psz;
p_config->value.psz = str;
p_config->b_dirty = true;
vlc_rwlock_unlock (&config_lock);
if( p_config->pf_callback )
{
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 );
free (oldstr);
}
#undef config_PutInt
@ -313,7 +301,6 @@ void config_PutInt( vlc_object_t *p_this, const char *psz_name,
int64_t i_value )
{
module_config_t *p_config;
vlc_value_t oldval;
p_config = config_FindConfig( p_this, psz_name );
@ -336,21 +323,9 @@ void config_PutInt( vlc_object_t *p_this, const char *psz_name,
i_value = p_config->max.i;
vlc_rwlock_wrlock (&config_lock);
/* backup old value */
oldval.i_int = p_config->value.i;
p_config->value.i = i_value;
p_config->b_dirty = true;
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
@ -364,7 +339,6 @@ void config_PutFloat( vlc_object_t *p_this,
const char *psz_name, float f_value )
{
module_config_t *p_config;
vlc_value_t oldval;
p_config = config_FindConfig( p_this, psz_name );
@ -390,21 +364,9 @@ void config_PutFloat( vlc_object_t *p_this,
f_value = p_config->max.f;
vlc_rwlock_wrlock (&config_lock);
/* backup old value */
oldval.f_float = p_config->value.f;
p_config->value.f = f_value;
p_config->b_dirty = true;
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)

View File

@ -59,7 +59,7 @@ static int CacheLoadConfig ( module_t *, FILE * );
/* Sub-version number
* (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 */
#define CACHENAME_FORMAT \
@ -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 )
{
uint32_t i_lines;
@ -441,11 +431,6 @@ static int CacheLoadConfig( module_t *p_module, FILE *file )
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;
@ -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++)
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;

View File

@ -259,11 +259,9 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
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;
}

View File

@ -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;
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 );
break;