25 #ifndef VLC_VARIABLES_H
26 #define VLC_VARIABLES_H 1
44 #define VLC_VAR_TYPE 0x00ff
45 #define VLC_VAR_CLASS 0x00f0
46 #define VLC_VAR_FLAGS 0xff00
53 #define VLC_VAR_VOID 0x0010
54 #define VLC_VAR_BOOL 0x0020
55 #define VLC_VAR_INTEGER 0x0030
56 #define VLC_VAR_HOTKEY 0x0031
57 #define VLC_VAR_STRING 0x0040
58 #define VLC_VAR_VARIABLE 0x0044
59 #define VLC_VAR_FLOAT 0x0050
60 #define VLC_VAR_TIME 0x0060
61 #define VLC_VAR_ADDRESS 0x0070
62 #define VLC_VAR_COORDS 0x00A0
70 #define VLC_VAR_HASCHOICE 0x0100
71 #define VLC_VAR_HASMIN 0x0200
72 #define VLC_VAR_HASMAX 0x0400
73 #define VLC_VAR_HASSTEP 0x0800
75 #define VLC_VAR_ISCOMMAND 0x2000
80 #define VLC_VAR_DOINHERIT 0x8000
96 #define VLC_VAR_SETMIN 0x0010
102 #define VLC_VAR_SETMAX 0x0011
103 #define VLC_VAR_SETSTEP 0x0012
110 #define VLC_VAR_SETVALUE 0x0013
112 #define VLC_VAR_SETTEXT 0x0014
113 #define VLC_VAR_GETTEXT 0x0015
115 #define VLC_VAR_GETMIN 0x0016
116 #define VLC_VAR_GETMAX 0x0017
117 #define VLC_VAR_GETSTEP 0x0018
119 #define VLC_VAR_ADDCHOICE 0x0020
120 #define VLC_VAR_DELCHOICE 0x0021
121 #define VLC_VAR_CLEARCHOICES 0x0022
122 #define VLC_VAR_SETDEFAULT 0x0023
123 #define VLC_VAR_GETCHOICES 0x0024
124 #define VLC_VAR_GETLIST 0x0025
125 #define VLC_VAR_CHOICESCOUNT 0x0026
127 #define VLC_VAR_SETISCOMMAND 0x0040
145 VLC_API
int var_Create(
vlc_object_t *,
const char *,
int );
146 #define var_Create(a,b,c) var_Create( VLC_OBJECT(a), b, c )
148 VLC_API
int var_Destroy(
vlc_object_t *,
const char * );
149 #define var_Destroy(a,b) var_Destroy( VLC_OBJECT(a), b )
152 #define var_Change(a,b,c,d,e) var_Change( VLC_OBJECT(a), b, c, d, e )
154 VLC_API
int var_Type(
vlc_object_t *,
const char * ) VLC_USED;
155 #define var_Type(a,b) var_Type( VLC_OBJECT(a), b )
158 #define var_Set(a,b,c) var_Set( VLC_OBJECT(a), b, c )
161 #define var_Get(a,b,c) var_Get( VLC_OBJECT(a), b, c )
164 #define var_SetChecked(o,n,t,v) var_SetChecked(VLC_OBJECT(o),n,t,v)
166 #define var_GetChecked(o,n,t,v) var_GetChecked(VLC_OBJECT(o),n,t,v)
183 VLC_API
int var_AddCallback(
vlc_object_t *,
const char *, vlc_callback_t,
void * );
184 VLC_API
int var_DelCallback(
vlc_object_t *,
const char *, vlc_callback_t,
void * );
185 VLC_API
int var_TriggerCallback(
vlc_object_t *,
const char * );
187 #define var_AddCallback(a,b,c,d) var_AddCallback( VLC_OBJECT(a), b, c, d )
188 #define var_DelCallback(a,b,c,d) var_DelCallback( VLC_OBJECT(a), b, c, d )
189 #define var_TriggerCallback(a,b) var_TriggerCallback( VLC_OBJECT(a), b )
202 static inline int var_SetInteger(
vlc_object_t *p_obj,
const char *psz_name,
207 return var_SetChecked( p_obj, psz_name, VLC_VAR_INTEGER, val );
217 static inline int var_SetBool(
vlc_object_t *p_obj,
const char *psz_name,
bool b )
221 return var_SetChecked( p_obj, psz_name, VLC_VAR_BOOL, val );
231 static inline int var_SetTime(
vlc_object_t *p_obj,
const char *psz_name, int64_t i )
235 return var_SetChecked( p_obj, psz_name, VLC_VAR_TIME, val );
238 static inline int var_SetCoords(
vlc_object_t *obj,
const char *name,
239 int32_t x, int32_t y )
244 return var_SetChecked (obj, name, VLC_VAR_COORDS, val);
246 #define var_SetCoords(o,n,x,y) var_SetCoords(VLC_OBJECT(o),n,x,y)
255 static inline int var_SetFloat(
vlc_object_t *p_obj,
const char *psz_name,
float f )
259 return var_SetChecked( p_obj, psz_name, VLC_VAR_FLOAT, val );
269 static inline int var_SetString(
vlc_object_t *p_obj,
const char *psz_name,
const char *psz_string )
272 val.psz_string = (
char *)psz_string;
273 return var_SetChecked( p_obj, psz_name, VLC_VAR_STRING, val );
284 int var_SetAddress(
vlc_object_t *p_obj,
const char *psz_name,
void *ptr )
288 return var_SetChecked( p_obj, psz_name, VLC_VAR_ADDRESS, val );
291 #define var_SetInteger(a,b,c) var_SetInteger( VLC_OBJECT(a),b,c)
292 #define var_SetBool(a,b,c) var_SetBool( VLC_OBJECT(a),b,c)
293 #define var_SetTime(a,b,c) var_SetTime( VLC_OBJECT(a),b,c)
294 #define var_SetFloat(a,b,c) var_SetFloat( VLC_OBJECT(a),b,c)
295 #define var_SetString(a,b,c) var_SetString( VLC_OBJECT(a),b,c)
296 #define var_SetAddress(o, n, p) var_SetAddress(VLC_OBJECT(o), n, p)
306 static inline int64_t var_GetInteger(
vlc_object_t *p_obj,
const char *psz_name )
309 if( !var_GetChecked( p_obj, psz_name, VLC_VAR_INTEGER, &val ) )
322 static inline bool var_GetBool(
vlc_object_t *p_obj,
const char *psz_name )
326 if( !var_GetChecked( p_obj, psz_name, VLC_VAR_BOOL, &val ) )
339 static inline int64_t var_GetTime(
vlc_object_t *p_obj,
const char *psz_name )
342 if( !var_GetChecked( p_obj, psz_name, VLC_VAR_TIME, &val ) )
348 static inline void var_GetCoords(
vlc_object_t *obj,
const char *name,
349 int32_t *px, int32_t *py )
353 if (likely(!var_GetChecked (obj, name, VLC_VAR_COORDS, &val)))
361 #define var_GetCoords(o,n,x,y) var_GetCoords(VLC_OBJECT(o),n,x,y)
370 static inline float var_GetFloat(
vlc_object_t *p_obj,
const char *psz_name )
373 if( !var_GetChecked( p_obj, psz_name, VLC_VAR_FLOAT, &val ) )
386 static inline char *var_GetString(
vlc_object_t *p_obj,
const char *psz_name )
389 if( var_GetChecked( p_obj, psz_name, VLC_VAR_STRING, &val ) )
392 return val.psz_string;
396 static inline char *var_GetNonEmptyString(
vlc_object_t *p_obj,
const char *psz_name )
399 if( var_GetChecked( p_obj, psz_name, VLC_VAR_STRING, &val ) )
401 if( val.psz_string && *val.psz_string )
402 return val.psz_string;
403 free( val.psz_string );
408 static inline void *var_GetAddress(
vlc_object_t *p_obj,
const char *psz_name )
411 if( var_GetChecked( p_obj, psz_name, VLC_VAR_ADDRESS, &val ) )
414 return val.p_address;
422 static inline int64_t var_IncInteger(
vlc_object_t *p_obj,
const char *psz_name )
429 #define var_IncInteger(a,b) var_IncInteger( VLC_OBJECT(a), b )
436 static inline int64_t var_DecInteger(
vlc_object_t *p_obj,
const char *psz_name )
443 #define var_DecInteger(a,b) var_DecInteger( VLC_OBJECT(a), b )
445 static inline uint64_t var_OrInteger(
vlc_object_t *obj,
const char *name,
453 #define var_OrInteger(a,b,c) var_OrInteger(VLC_OBJECT(a),b,c)
455 static inline uint64_t var_NAndInteger(
vlc_object_t *obj,
const char *name,
463 #define var_NAndInteger(a,b,c) var_NAndInteger(VLC_OBJECT(a),b,c)
472 static inline int64_t var_CreateGetInteger(
vlc_object_t *p_obj,
const char *psz_name )
475 return var_GetInteger( p_obj, psz_name );
485 static inline bool var_CreateGetBool(
vlc_object_t *p_obj,
const char *psz_name )
488 return var_GetBool( p_obj, psz_name );
498 static inline int64_t var_CreateGetTime(
vlc_object_t *p_obj,
const char *psz_name )
501 return var_GetTime( p_obj, psz_name );
511 static inline float var_CreateGetFloat(
vlc_object_t *p_obj,
const char *psz_name )
514 return var_GetFloat( p_obj, psz_name );
524 static inline char *var_CreateGetString(
vlc_object_t *p_obj,
525 const char *psz_name )
528 return var_GetString( p_obj, psz_name );
532 static inline char *var_CreateGetNonEmptyString(
vlc_object_t *p_obj,
533 const char *psz_name )
536 return var_GetNonEmptyString( p_obj, psz_name );
546 static inline void *var_CreateGetAddress(
vlc_object_t *p_obj,
547 const char *psz_name )
550 return var_GetAddress( p_obj, psz_name );
553 #define var_CreateGetInteger(a,b) var_CreateGetInteger( VLC_OBJECT(a),b)
554 #define var_CreateGetBool(a,b) var_CreateGetBool( VLC_OBJECT(a),b)
555 #define var_CreateGetTime(a,b) var_CreateGetTime( VLC_OBJECT(a),b)
556 #define var_CreateGetFloat(a,b) var_CreateGetFloat( VLC_OBJECT(a),b)
557 #define var_CreateGetString(a,b) var_CreateGetString( VLC_OBJECT(a),b)
558 #define var_CreateGetNonEmptyString(a,b) var_CreateGetNonEmptyString( VLC_OBJECT(a),b)
559 #define var_CreateGetAddress(a,b) var_CreateGetAddress( VLC_OBJECT(a),b)
568 static inline int64_t var_CreateGetIntegerCommand(
vlc_object_t *p_obj,
const char *psz_name )
571 | VLC_VAR_ISCOMMAND );
572 return var_GetInteger( p_obj, psz_name );
582 static inline bool var_CreateGetBoolCommand(
vlc_object_t *p_obj,
const char *psz_name )
585 | VLC_VAR_ISCOMMAND );
586 return var_GetBool( p_obj, psz_name );
596 static inline int64_t var_CreateGetTimeCommand(
vlc_object_t *p_obj,
const char *psz_name )
599 | VLC_VAR_ISCOMMAND );
600 return var_GetTime( p_obj, psz_name );
610 static inline float var_CreateGetFloatCommand(
vlc_object_t *p_obj,
const char *psz_name )
613 | VLC_VAR_ISCOMMAND );
614 return var_GetFloat( p_obj, psz_name );
624 static inline char *var_CreateGetStringCommand(
vlc_object_t *p_obj,
625 const char *psz_name )
628 | VLC_VAR_ISCOMMAND );
629 return var_GetString( p_obj, psz_name );
633 static inline char *var_CreateGetNonEmptyStringCommand(
vlc_object_t *p_obj,
634 const char *psz_name )
637 | VLC_VAR_ISCOMMAND );
638 return var_GetNonEmptyString( p_obj, psz_name );
641 #define var_CreateGetIntegerCommand(a,b) var_CreateGetIntegerCommand( VLC_OBJECT(a),b)
642 #define var_CreateGetBoolCommand(a,b) var_CreateGetBoolCommand( VLC_OBJECT(a),b)
643 #define var_CreateGetTimeCommand(a,b) var_CreateGetTimeCommand( VLC_OBJECT(a),b)
644 #define var_CreateGetFloatCommand(a,b) var_CreateGetFloatCommand( VLC_OBJECT(a),b)
645 #define var_CreateGetStringCommand(a,b) var_CreateGetStringCommand( VLC_OBJECT(a),b)
646 #define var_CreateGetNonEmptyStringCommand(a,b) var_CreateGetNonEmptyStringCommand( VLC_OBJECT(a),b)
649 static inline int var_CountChoices(
vlc_object_t *p_obj,
const char *psz_name )
652 if( var_Change( p_obj, psz_name, VLC_VAR_CHOICESCOUNT, &count, NULL ) )
656 #define var_CountChoices(a,b) var_CountChoices( VLC_OBJECT(a),b)
659 static inline bool var_ToggleBool(
vlc_object_t *p_obj,
const char *psz_name )
665 #define var_ToggleBool(a,b) var_ToggleBool( VLC_OBJECT(a),b )
669 static inline bool var_InheritBool(
vlc_object_t *obj,
const char *name )
673 if( var_Inherit( obj, name, VLC_VAR_BOOL, &val ) )
677 #define var_InheritBool(o, n) var_InheritBool(VLC_OBJECT(o), n)
680 static inline int64_t var_InheritInteger(
vlc_object_t *obj,
const char *name )
684 if( var_Inherit( obj, name, VLC_VAR_INTEGER, &val ) )
688 #define var_InheritInteger(o, n) var_InheritInteger(VLC_OBJECT(o), n)
691 static inline float var_InheritFloat(
vlc_object_t *obj,
const char *name )
695 if( var_Inherit( obj, name, VLC_VAR_FLOAT, &val ) )
699 #define var_InheritFloat(o, n) var_InheritFloat(VLC_OBJECT(o), n)
702 static inline char *var_InheritString(
vlc_object_t *obj,
const char *name )
706 if( var_Inherit( obj, name, VLC_VAR_STRING, &val ) )
707 val.psz_string = NULL;
708 else if( val.psz_string && !*val.psz_string )
710 free( val.psz_string );
711 val.psz_string = NULL;
713 return val.psz_string;
715 #define var_InheritString(o, n) var_InheritString(VLC_OBJECT(o), n)
722 if( var_Inherit( obj, name, VLC_VAR_TIME, &val ) )
726 #define var_InheritTime(o, n) var_InheritTime(VLC_OBJECT(o), n)
729 static inline void *var_InheritAddress(
vlc_object_t *obj,
const char *name )
733 if( var_Inherit( obj, name, VLC_VAR_ADDRESS, &val ) )
734 val.p_address = NULL;
735 return val.p_address;
737 #define var_InheritAddress(o, n) var_InheritAddress(VLC_OBJECT(o), n)
739 VLC_API
int var_InheritURational(
vlc_object_t *,
unsigned *num,
unsigned *den,
const char *var );
740 #define var_InheritURational(a,b,c,d) var_InheritURational(VLC_OBJECT(a), b, c, d)
742 #define var_GetInteger(a,b) var_GetInteger( VLC_OBJECT(a),b)
743 #define var_GetBool(a,b) var_GetBool( VLC_OBJECT(a),b)
744 #define var_GetTime(a,b) var_GetTime( VLC_OBJECT(a),b)
745 #define var_GetFloat(a,b) var_GetFloat( VLC_OBJECT(a),b)
746 #define var_GetString(a,b) var_GetString( VLC_OBJECT(a),b)
747 #define var_GetNonEmptyString(a,b) var_GetNonEmptyString( VLC_OBJECT(a),b)
748 #define var_GetAddress(a,b) var_GetAddress( VLC_OBJECT(a),b)
750 VLC_API
int var_LocationParse(
vlc_object_t *,
const char *mrl,
const char *prefix);
751 #define var_LocationParse(o, m, p) var_LocationParse(VLC_OBJECT(o), m, p)
Definition: vlc_variables.h:135
Definition: vlc_common.h:345
#define VLC_VAR_DOINHERIT
Definition: vlc_variables.h:80
Definition: vlc_variables.h:136
Definition: vlc_variables.h:137
int64_t mtime_t
Definition: vlc_common.h:153
Definition: vlc_variables.h:138
Definition: vlc_objects.h:42