Commit 02752dc7 authored by Antoine Cellerier's avatar Antoine Cellerier

Add VLC_VAR_GET{MIN,MAX,STEP} commands. Make it possible to use...

Add VLC_VAR_GET{MIN,MAX,STEP} commands. Make it possible to use VLC_VAR_INHERITVALUE with a 2nd argument which will be used as the variable name to inherit (for example you want to inherit a variable named "v4l2-hue" into a variable named "hue": vlc_value_t val; val.psz_string = strdup( "v4l2-hue" ); var_Change( p_demux, "hue", VLC_VAR_INHERITVALUE, NULL, &val ); free( val.psz_string ); )
parent 16e5f077
......@@ -94,6 +94,10 @@
#define VLC_VAR_SETTEXT 0x0014
#define VLC_VAR_GETTEXT 0x0015
#define VLC_VAR_GETMIN 0x0016
#define VLC_VAR_GETMAX 0x0017
#define VLC_VAR_GETSTEP 0x0018
#define VLC_VAR_ADDCHOICE 0x0020
#define VLC_VAR_DELCHOICE 0x0021
#define VLC_VAR_CLEARCHOICES 0x0022
......
......@@ -241,7 +241,7 @@ int __var_Create( vlc_object_t *p_this, const char *psz_name, int i_type )
p_var->pf_cmp = CmpString;
p_var->pf_dup = DupString;
p_var->pf_free = FreeString;
p_var->val.psz_string = "";
p_var->val.psz_string = strdup( "" );
break;
case VLC_VAR_FLOAT:
p_var->pf_cmp = CmpFloat;
......@@ -420,6 +420,12 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name,
p_var->pf_dup( &p_var->min );
CheckValue( p_var, &p_var->val );
break;
case VLC_VAR_GETMIN:
if( p_var->i_type & VLC_VAR_HASMIN )
{
*p_val = p_var->min;
}
break;
case VLC_VAR_SETMAX:
if( p_var->i_type & VLC_VAR_HASMAX )
{
......@@ -430,6 +436,12 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name,
p_var->pf_dup( &p_var->max );
CheckValue( p_var, &p_var->val );
break;
case VLC_VAR_GETMAX:
if( p_var->i_type & VLC_VAR_HASMAX )
{
*p_val = p_var->max;
}
break;
case VLC_VAR_SETSTEP:
if( p_var->i_type & VLC_VAR_HASSTEP )
{
......@@ -440,6 +452,12 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name,
p_var->pf_dup( &p_var->step );
CheckValue( p_var, &p_var->val );
break;
case VLC_VAR_GETSTEP:
if( p_var->i_type & VLC_VAR_HASSTEP )
{
*p_val = p_var->step;
}
break;
case VLC_VAR_ADDCHOICE:
/* FIXME: the list is sorted, dude. Use something cleverer. */
for( i = p_var->choices.i_count ; i-- ; )
......@@ -622,7 +640,9 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name,
{
vlc_value_t val;
if( InheritValue( p_this, psz_name, &val, p_var->i_type )
if( InheritValue( p_this,
p_val2 ? p_val2->psz_string : psz_name,
&val, p_var->i_type )
== VLC_SUCCESS )
{
/* Duplicate already done */
......@@ -1092,6 +1112,7 @@ void __var_OptionParse( vlc_object_t *p_obj, const char *psz_option )
case VLC_VAR_MODULE:
case VLC_VAR_FILE:
case VLC_VAR_DIRECTORY:
if( val.psz_string ) free( val.psz_string );
val.psz_string = psz_value;
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