]> git.sesse.net Git - vlc/blobdiff - include/vlc_variables.h
Fix Metacube header handling with multiple header blocks.
[vlc] / include / vlc_variables.h
index 8faea3f34b6c8073b0c93782a82a708ef10efc7d..533b97e8aec919fee94527d1f31b8312c9289bfb 100644 (file)
@@ -1,25 +1,25 @@
 /*****************************************************************************
- * 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
  * @{
  */
 
-/*****************************************************************************
- * Variable types - probably very incomplete
- *****************************************************************************/
 #define VLC_VAR_TYPE      0x00ff
 #define VLC_VAR_CLASS     0x00f0
 #define VLC_VAR_FLAGS     0xff00
 
+/**
+ * \defgroup var_type Variable types
+ * These are the different types a vlc variable can have.
+ * @{
+ */
+#define VLC_VAR_VOID      0x0010
+#define VLC_VAR_BOOL      0x0020
+#define VLC_VAR_INTEGER   0x0030
+#define VLC_VAR_HOTKEY    0x0031
+#define VLC_VAR_STRING    0x0040
+#define VLC_VAR_VARIABLE  0x0044
+#define VLC_VAR_FLOAT     0x0050
+#define VLC_VAR_TIME      0x0060
+#define VLC_VAR_ADDRESS   0x0070
+#define VLC_VAR_COORDS    0x00A0
+/**@}*/
+
 /** \defgroup var_flags Additive flags
  * These flags are added to the type field of the variable. Most as a result of
  * a var_Change() call, but some may be added at creation time
 #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
@@ -154,9 +167,6 @@ VLC_API int var_GetAndSet( vlc_object_t *, const char *, int, vlc_value_t * );
 
 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 * );
 
 
@@ -173,10 +183,16 @@ VLC_API int var_AddCallback( vlc_object_t *, const char *, vlc_callback_t, void
 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
  *****************************************************************************/
@@ -412,7 +428,8 @@ static inline int64_t var_IncInteger( vlc_object_t *p_obj, const char *psz_name
 {
     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 )
@@ -426,7 +443,8 @@ static inline int64_t var_DecInteger( vlc_object_t *p_obj, const char *psz_name
 {
     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 )
@@ -436,7 +454,8 @@ static inline uint64_t var_OrInteger( vlc_object_t *obj, const char *name,
 {
     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)
@@ -446,7 +465,8 @@ static inline uint64_t var_NAndInteger( vlc_object_t *obj, const char *name,
 {
     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)
@@ -648,7 +668,8 @@ static inline int var_CountChoices( vlc_object_t *p_obj, const char *psz_name )
 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 )