]> git.sesse.net Git - vlc/blobdiff - include/vlc_variables.h
Update THANKS.
[vlc] / include / vlc_variables.h
index 79c95e3ac0de99acb9ce6f9bf91892e5991530ec..2261c82e29f2daf5fb04a3d8c3ce5e87fb144189 100644 (file)
 #define VLC_VAR_GETCHOICES          0x0024
 #define VLC_VAR_FREECHOICES         0x0025
 #define VLC_VAR_GETLIST             0x0026
-#define VLC_VAR_FREELIST            0x0027
-#define VLC_VAR_CHOICESCOUNT        0x0028
+#define VLC_VAR_CHOICESCOUNT        0x0027
 
 #define VLC_VAR_INHERITVALUE        0x0030
 
@@ -134,6 +133,8 @@ VLC_EXPORT( int, var_GetChecked, ( vlc_object_t *, const char *, int, vlc_value_
 #define var_Command(a,b,c,d,e) __var_Command( VLC_OBJECT( a ), b, c, d, e )
 VLC_EXPORT( int, __var_Command, ( vlc_object_t *, const char *, const char *, const char *, char ** ) );
 
+VLC_EXPORT( void, var_FreeList, ( vlc_value_t *, vlc_value_t * ) );
+
 /**
  * __var_Create() with automatic casting.
  */
@@ -277,6 +278,23 @@ static inline int __var_SetVoid( vlc_object_t *p_obj, const char *psz_name )
 }
 #define var_SetVoid(a,b)        __var_SetVoid( VLC_OBJECT(a),b)
 
+/**
+ * Set the value of a pointer variable
+ *
+ * \param p_obj The object that holds the variable
+ * \param psz_name The name of the variable
+ * \param ptr The new pointer value of this variable
+ */
+static inline
+int var_SetAddress( vlc_object_t *p_obj, const char *psz_name, void *ptr )
+{
+    vlc_value_t val;
+    val.p_address = ptr;
+    return var_SetChecked( p_obj, psz_name, VLC_VAR_ADDRESS, val );
+}
+#define var_SetAddress(o, n, p) var_SetAddress(VLC_OBJECT(o), n, p)
+
+
 /**
  * __var_SetBool() with automatic casting
  */
@@ -382,7 +400,7 @@ static inline char *__var_GetNonEmptyString( vlc_object_t *p_obj, const char *ps
     vlc_value_t val;
     if( var_GetChecked( p_obj, psz_name, VLC_VAR_STRING, &val ) )
         return NULL;
-    if( *val.psz_string )
+    if( val.psz_string && *val.psz_string )
         return val.psz_string;
     free( val.psz_string );
     return NULL;
@@ -634,6 +652,19 @@ static inline char *__var_CreateGetNonEmptyStringCommand( vlc_object_t *p_obj,
  */
 #define var_CreateGetStringCommand(a,b)   __var_CreateGetStringCommand( VLC_OBJECT(a),b)
 #define var_CreateGetNonEmptyStringCommand(a,b)   __var_CreateGetNonEmptyStringCommand( VLC_OBJECT(a),b)
+
+static inline int __var_CountChoices( vlc_object_t *p_obj, const char *psz_name )
+{
+    vlc_value_t count;
+    if( __var_Change( p_obj, psz_name, VLC_VAR_CHOICESCOUNT, &count, NULL ) )
+        return 0;
+    return count.i_int;
+}
+/**
+ * __var_CountChoices() with automatic casting
+ */
+#define var_CountChoices(a,b) __var_CountChoices( VLC_OBJECT(a),b)
+
 /**
  * @}
  */