Commit 8583c1e6 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

variables: remove write-only variable default value

parent 7c3221dd
......@@ -96,7 +96,6 @@
#define VLC_VAR_ADDCHOICE 0x0020
#define VLC_VAR_DELCHOICE 0x0021
#define VLC_VAR_CLEARCHOICES 0x0022
#define VLC_VAR_SETDEFAULT 0x0023
#define VLC_VAR_GETCHOICES 0x0024
#define VLC_VAR_CHOICESCOUNT 0x0026
......
......@@ -400,8 +400,6 @@ static vlc_v4l2_ctrl_t *ControlAddInteger (vlc_object_t *obj, int fd,
val.i_int = query->step;
var_Change (obj, c->name, VLC_VAR_SETSTEP, &val, NULL);
}
val.i_int = query->default_value;
var_Change (obj, c->name, VLC_VAR_SETDEFAULT, &val, NULL);
return c;
}
......@@ -433,8 +431,6 @@ static vlc_v4l2_ctrl_t *ControlAddBoolean (vlc_object_t *obj, int fd,
val.b_bool = ctrl.value;
var_Change (obj, c->name, VLC_VAR_SETVALUE, &val, NULL);
}
val.b_bool = query->default_value;
var_Change (obj, c->name, VLC_VAR_SETDEFAULT, &val, NULL);
return c;
}
......@@ -469,8 +465,6 @@ static vlc_v4l2_ctrl_t *ControlAddMenu (vlc_object_t *obj, int fd,
var_Change (obj, c->name, VLC_VAR_SETMINMAX,
&(vlc_value_t){ .i_int = query->minimum },
&(vlc_value_t){ .i_int = query->maximum } );
val.i_int = query->default_value;
var_Change (obj, c->name, VLC_VAR_SETDEFAULT, &val, NULL);
/* Import menu choices */
for (uint_fast32_t idx = query->minimum;
......@@ -630,8 +624,6 @@ static vlc_v4l2_ctrl_t *ControlAddBitMask (vlc_object_t *obj, int fd,
var_Change (obj, c->name, VLC_VAR_SETMINMAX,
&(vlc_value_t){ .i_int = 0 },
&(vlc_value_t){ .i_int = (uint32_t)query->maximum } );
val.i_int = query->default_value;
var_Change (obj, c->name, VLC_VAR_SETDEFAULT, &val, NULL);
return c;
}
......@@ -666,8 +658,6 @@ static vlc_v4l2_ctrl_t *ControlAddIntMenu (vlc_object_t *obj, int fd,
var_Change (obj, c->name, VLC_VAR_SETMINMAX,
&(vlc_value_t){ .i_int = query->minimum },
&(vlc_value_t){ .i_int = query->maximum } );
val.i_int = query->default_value;
var_Change (obj, c->name, VLC_VAR_SETDEFAULT, &val, NULL);
/* Import menu choices */
for (uint_fast32_t idx = query->minimum;
......
......@@ -88,9 +88,6 @@ struct variable_t
/** If the variable has min/max/step values */
vlc_value_t min, max, step;
/** Index of the default choice, if the variable is to be chosen in
* a list */
int i_default;
/** List of choices */
vlc_list_t choices;
/** List of friendly names for the choices */
......@@ -312,7 +309,6 @@ int var_Create( vlc_object_t *p_this, const char *psz_name, int i_type )
p_var->i_usage = 1;
p_var->i_default = -1;
p_var->choices.i_count = 0;
p_var->choices.p_values = NULL;
p_var->choices_text.i_count = 0;
......@@ -535,11 +531,6 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
return VLC_EGENERIC;
}
if( p_var->i_default > i )
p_var->i_default--;
else if( p_var->i_default == i )
p_var->i_default = -1;
p_var->ops->pf_free( &p_var->choices.p_values[i] );
free( p_var->choices_text.p_values[i].psz_string );
REMOVE_ELEM( p_var->choices.p_values, p_var->choices.i_count, i );
......@@ -567,25 +558,8 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
p_var->choices.p_values = NULL;
p_var->choices_text.i_count = 0;
p_var->choices_text.p_values = NULL;
p_var->i_default = -1;
TriggerListCallback(p_this, p_var, psz_name, VLC_VAR_CLEARCHOICES, NULL);
break;
case VLC_VAR_SETDEFAULT:
{
int i;
/* FIXME: the list is sorted, dude. Use something cleverer. */
for( i = 0 ; i < p_var->choices.i_count ; i++ )
if( p_var->ops->pf_cmp( p_var->choices.p_values[i], *p_val ) == 0 )
break;
if( i == p_var->choices.i_count )
/* Not found */
break;
p_var->i_default = i;
CheckValue( p_var, &p_var->val );
break;
}
case VLC_VAR_SETVALUE:
/* Duplicate data if needed */
newval = *p_val;
......
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