Commit 897d37e4 authored by Filip Roséen's avatar Filip Roséen Committed by Thomas Guillem

vlc_variables: add VLC_VAR_SETMINMAX

Most of the time when you wanna limit the range of possible values for
a variable you do so my specifying both the lower and upper bound.

As such it certainly make sense to have a var_Change specifier to set
both, instead of doing one at a time.
Signed-off-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
parent 38d2451e
......@@ -115,6 +115,7 @@
#define VLC_VAR_GETCHOICES 0x0024
#define VLC_VAR_CHOICESCOUNT 0x0026
#define VLC_VAR_SETMINMAX 0x0027
/**@}*/
......
......@@ -529,6 +529,25 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
else
ret = VLC_EGENERIC;
break;
case VLC_VAR_SETMINMAX:
if( p_var->i_type & VLC_VAR_HASMIN )
{
p_var->ops->pf_free( &p_var->min );
}
p_var->i_type |= VLC_VAR_HASMIN;
p_var->min = *p_val;
p_var->ops->pf_dup( &p_var->min );
if( p_var->i_type & VLC_VAR_HASMAX )
{
p_var->ops->pf_free( &p_var->max );
}
p_var->i_type |= VLC_VAR_HASMAX;
p_var->max = *p_val2;
p_var->ops->pf_dup( &p_var->max );
break;
case VLC_VAR_SETSTEP:
if( p_var->i_type & VLC_VAR_HASSTEP )
{
......
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