variables.c File Reference

Include dependency graph for variables.c:


Data Structures

struct  callback_entry_t

Functions

static int CmpBool (vlc_value_t v, vlc_value_t w)
static int CmpInt (vlc_value_t v, vlc_value_t w)
static int CmpTime (vlc_value_t v, vlc_value_t w)
static int CmpString (vlc_value_t v, vlc_value_t w)
static int CmpFloat (vlc_value_t v, vlc_value_t w)
static int CmpAddress (vlc_value_t v, vlc_value_t w)
static void DupDummy (vlc_value_t *p_val)
static void DupString (vlc_value_t *p_val)
static void DupList (vlc_value_t *p_val)
static void FreeDummy (vlc_value_t *p_val)
static void FreeString (vlc_value_t *p_val)
static void FreeMutex (vlc_value_t *p_val)
static void FreeList (vlc_value_t *p_val)
static int GetUnused (vlc_object_t *, const char *)
static uint32_t HashString (const char *)
static int Insert (variable_t *, int, const char *)
static int InsertInner (variable_t *, int, uint32_t)
static int Lookup (variable_t *, int, const char *)
static int LookupInner (variable_t *, int, uint32_t)
static void CheckValue (variable_t *, vlc_value_t *)
static int InheritValue (vlc_object_t *, const char *, vlc_value_t *, int)
int __var_Create (vlc_object_t *p_this, const char *psz_name, int i_type)
 Initialize a vlc variable.
int __var_Destroy (vlc_object_t *p_this, const char *psz_name)
 Destroy a vlc variable.
int __var_Change (vlc_object_t *p_this, const char *psz_name, int i_action, vlc_value_t *p_val, vlc_value_t *p_val2)
 Perform an action on a variable.
int __var_Type (vlc_object_t *p_this, const char *psz_name)
 Request a variable's type.
int __var_Set (vlc_object_t *p_this, const char *psz_name, vlc_value_t val)
 Set a variable's value.
int __var_Get (vlc_object_t *p_this, const char *psz_name, vlc_value_t *p_val)
 Get a variable's value.
vlc_mutex_t * var_AcquireMutex (const char *name)
 Finds a process-wide mutex, creates it if needed, and locks it.
int __var_AddCallback (vlc_object_t *p_this, const char *psz_name, vlc_callback_t pf_callback, void *p_data)
 Register a callback in a variable.
int __var_DelCallback (vlc_object_t *p_this, const char *psz_name, vlc_callback_t pf_callback, void *p_data)
 Remove a callback from a variable.
int __var_TriggerCallback (vlc_object_t *p_this, const char *psz_name)
 Trigger callback on a variable.
void var_OptionParse (vlc_object_t *p_obj, const char *psz_option, bool trusted)
 Parse a stringified option This function parse a string option and create the associated object variable The option must be of the form "[no[-]]foo[=bar]" where foo is the option name and bar is the value of the option.
int __var_Command (vlc_object_t *p_this, const char *psz_name, const char *psz_cmd, const char *psz_arg, char **psz_msg)

Function Documentation

int __var_AddCallback ( vlc_object_t p_this,
const char *  psz_name,
vlc_callback_t  pf_callback,
void *  p_data 
)

Register a callback in a variable.

We store a function pointer that will be called upon variable modification.

Parameters:
p_this The object that holds the variable
psz_name The name of the variable
pf_callback The function pointer
p_data A generic pointer that will be passed as the last argument to the callback function.
Warning:
The callback function is run in the thread that calls var_Set on the variable. Use proper locking. This thread may not have much time to spare, so keep callback functions short.

int __var_Change ( vlc_object_t p_this,
const char *  psz_name,
int  i_action,
vlc_value_t p_val,
vlc_value_t p_val2 
)

Perform an action on a variable.

Parameters:
p_this The object that holds the variable
psz_name The name of the variable
i_action The action to perform. Must be one of var_action
p_val First action parameter
p_val2 Second action parameter

int __var_Command ( vlc_object_t p_this,
const char *  psz_name,
const char *  psz_cmd,
const char *  psz_arg,
char **  psz_msg 
)

int __var_Create ( vlc_object_t p_this,
const char *  psz_name,
int  i_type 
)

Initialize a vlc variable.

We hash the given string and insert it into the sorted list. The insertion may require slow memory copies, but think about what we gain in the log(n) lookup phase when setting/getting the variable value!

Parameters:
p_this The object in which to create the variable
psz_name The name of the variable
i_type The variables type. Must be one of Variable types combined with zero or more var_flags

int __var_DelCallback ( vlc_object_t p_this,
const char *  psz_name,
vlc_callback_t  pf_callback,
void *  p_data 
)

Remove a callback from a variable.

pf_callback and p_data have to be given again, because different objects might have registered the same callback function.

int __var_Destroy ( vlc_object_t p_this,
const char *  psz_name 
)

Destroy a vlc variable.

Look for the variable and destroy it if it is found. As in var_Create we do a call to memmove() but we have performance counterparts elsewhere.

Parameters:
p_this The object that holds the variable
psz_name The name of the variable

int __var_Get ( vlc_object_t p_this,
const char *  psz_name,
vlc_value_t p_val 
)

Get a variable's value.

Parameters:
p_this The object that holds the variable
psz_name The name of the variable
p_val Pointer to a vlc_value_t that will hold the variable's value after the function is finished

int __var_Set ( vlc_object_t p_this,
const char *  psz_name,
vlc_value_t  val 
)

Set a variable's value.

Parameters:
p_this The object that hold the variable
psz_name The name of the variable
val the value to set

int __var_TriggerCallback ( vlc_object_t p_this,
const char *  psz_name 
)

Trigger callback on a variable.

Parameters:
p_this The object that hold the variable
psz_name The name of the variable

int __var_Type ( vlc_object_t p_this,
const char *  psz_name 
)

Request a variable's type.

Returns:
The variable type if it exists, or 0 if the variable could not be found.
See also:
Variable types

static void CheckValue ( variable_t ,
vlc_value_t  
) [static]

static int CmpAddress ( vlc_value_t  v,
vlc_value_t  w 
) [static]

static int CmpBool ( vlc_value_t  v,
vlc_value_t  w 
) [static]

static int CmpFloat ( vlc_value_t  v,
vlc_value_t  w 
) [static]

static int CmpInt ( vlc_value_t  v,
vlc_value_t  w 
) [static]

static int CmpString ( vlc_value_t  v,
vlc_value_t  w 
) [static]

static int CmpTime ( vlc_value_t  v,
vlc_value_t  w 
) [static]

static void DupDummy ( vlc_value_t p_val  )  [static]

static void DupList ( vlc_value_t p_val  )  [static]

static void DupString ( vlc_value_t p_val  )  [static]

static void FreeDummy ( vlc_value_t p_val  )  [static]

static void FreeList ( vlc_value_t p_val  )  [static]

static void FreeMutex ( vlc_value_t p_val  )  [static]

static void FreeString ( vlc_value_t p_val  )  [static]

static int GetUnused ( vlc_object_t ,
const char *   
) [static]

static uint32_t HashString ( const char *   )  [static]

static int InheritValue ( vlc_object_t ,
const char *  ,
vlc_value_t ,
int   
) [static]

static int Insert ( variable_t ,
int  ,
const char *   
) [static]

static int InsertInner ( variable_t ,
int  ,
uint32_t   
) [static]

static int Lookup ( variable_t ,
int  ,
const char *   
) [static]

static int LookupInner ( variable_t ,
int  ,
uint32_t   
) [static]

vlc_mutex_t* var_AcquireMutex ( const char *  name  ) 

Finds a process-wide mutex, creates it if needed, and locks it.

Unlock with vlc_mutex_unlock().

void var_OptionParse ( vlc_object_t p_obj,
const char *  psz_option,
bool  trusted 
)

Parse a stringified option This function parse a string option and create the associated object variable The option must be of the form "[no[-]]foo[=bar]" where foo is the option name and bar is the value of the option.

Parameters:
p_obj the object in which the variable must be created
psz_option the option to parse
trusted whether the option is set by a trusted input or not
Returns:
nothing


Generated on Wed Aug 13 08:05:42 2008 for VLC by  doxygen 1.5.1