[vlc-commits] variables: remove write-only variable default value
Rémi Denis-Courmont
git at videolan.org
Sat Oct 22 16:56:21 CEST 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 22 17:45:19 2016 +0300| [8583c1e66997d9f48a0243399247d55b9c6e3a3c] | committer: Rémi Denis-Courmont
variables: remove write-only variable default value
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8583c1e66997d9f48a0243399247d55b9c6e3a3c
---
include/vlc_variables.h | 1 -
modules/access/v4l2/controls.c | 10 ----------
src/misc/variables.c | 26 --------------------------
3 files changed, 37 deletions(-)
diff --git a/include/vlc_variables.h b/include/vlc_variables.h
index 646b02e..83752b1 100644
--- a/include/vlc_variables.h
+++ b/include/vlc_variables.h
@@ -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
diff --git a/modules/access/v4l2/controls.c b/modules/access/v4l2/controls.c
index 52879c5..dec31a4 100644
--- a/modules/access/v4l2/controls.c
+++ b/modules/access/v4l2/controls.c
@@ -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;
diff --git a/src/misc/variables.c b/src/misc/variables.c
index 275fdb3..28aee67 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -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;
More information about the vlc-commits
mailing list