/*****************************************************************************
- * variables.h: variables handling
+ * vlc_variables.h: variables handling
*****************************************************************************
- * Copyright (C) 2002-2004 the VideoLAN team
+ * Copyright (C) 2002-2004 VLC authors and VideoLAN
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Gildas Bazin <gbazin@netcourrier.com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef VLC_VARIABLES_H
#define VLC_VAR_CLEARCHOICES 0x0022
#define VLC_VAR_SETDEFAULT 0x0023
#define VLC_VAR_GETCHOICES 0x0024
-#define VLC_VAR_GETLIST 0x0025
+
#define VLC_VAR_CHOICESCOUNT 0x0026
-#define VLC_VAR_SETISCOMMAND 0x0040
/**@}*/
/** \defgroup var_GetAndSet Variable actions
VLC_API int var_Inherit( vlc_object_t *, const char *, int, vlc_value_t * );
-VLC_API int var_Command( vlc_object_t *, const char *, const char *, const char *, char ** );
-#define var_Command(a,b,c,d,e) var_Command( VLC_OBJECT( a ), b, c, d, e )
-
VLC_API void var_FreeList( vlc_value_t *, vlc_value_t * );
VLC_API int var_DelCallback( vlc_object_t *, const char *, vlc_callback_t, void * );
VLC_API int var_TriggerCallback( vlc_object_t *, const char * );
+VLC_API int var_AddListCallback( vlc_object_t *, const char *, vlc_list_callback_t, void * );
+VLC_API int var_DelListCallback( vlc_object_t *, const char *, vlc_list_callback_t, void * );
+
#define var_AddCallback(a,b,c,d) var_AddCallback( VLC_OBJECT(a), b, c, d )
#define var_DelCallback(a,b,c,d) var_DelCallback( VLC_OBJECT(a), b, c, d )
#define var_TriggerCallback(a,b) var_TriggerCallback( VLC_OBJECT(a), b )
+#define var_AddListCallback(a,b,c,d) var_AddListCallback( VLC_OBJECT(a), b, c, d )
+#define var_DelListCallback(a,b,c,d) var_DelListCallback( VLC_OBJECT(a), b, c, d )
+
/*****************************************************************************
* helpers functions
*****************************************************************************/
{
vlc_value_t val;
val.i_int = 1;
- var_GetAndSet( p_obj, psz_name, VLC_VAR_INTEGER_ADD, &val );
+ if( var_GetAndSet( p_obj, psz_name, VLC_VAR_INTEGER_ADD, &val ) )
+ return 0;
return val.i_int;
}
#define var_IncInteger(a,b) var_IncInteger( VLC_OBJECT(a), b )
{
vlc_value_t val;
val.i_int = -1;
- var_GetAndSet( p_obj, psz_name, VLC_VAR_INTEGER_ADD, &val );
+ if( var_GetAndSet( p_obj, psz_name, VLC_VAR_INTEGER_ADD, &val ) )
+ return 0;
return val.i_int;
}
#define var_DecInteger(a,b) var_DecInteger( VLC_OBJECT(a), b )
{
vlc_value_t val;
val.i_int = v;
- var_GetAndSet( obj, name, VLC_VAR_INTEGER_OR, &val );
+ if( var_GetAndSet( obj, name, VLC_VAR_INTEGER_OR, &val ) )
+ return 0;
return val.i_int;
}
#define var_OrInteger(a,b,c) var_OrInteger(VLC_OBJECT(a),b,c)
{
vlc_value_t val;
val.i_int = v;
- var_GetAndSet( obj, name, VLC_VAR_INTEGER_NAND, &val );
+ if( var_GetAndSet( obj, name, VLC_VAR_INTEGER_NAND, &val ) )
+ return 0;
return val.i_int;
}
#define var_NAndInteger(a,b,c) var_NAndInteger(VLC_OBJECT(a),b,c)
static inline bool var_ToggleBool( vlc_object_t *p_obj, const char *psz_name )
{
vlc_value_t val;
- var_GetAndSet( p_obj, psz_name, VLC_VAR_BOOL_TOGGLE, &val );
+ if( var_GetAndSet( p_obj, psz_name, VLC_VAR_BOOL_TOGGLE, &val ) )
+ return false;
return val.b_bool;
}
#define var_ToggleBool(a,b) var_ToggleBool( VLC_OBJECT(a),b )