Difference between revisions of "Hacker Guide/Variables"

From VideoLAN Wiki
Jump to navigation Jump to search
Line 22: Line 22:
 
=== var_Inherit ===
 
=== var_Inherit ===
 
'''var_Inherit*''' functions will get the default value (from configuration, for example) or the one set by the parent object.
 
'''var_Inherit*''' functions will get the default value (from configuration, for example) or the one set by the parent object.
 +
var_InheritBool
 +
var_InheritInteger
 +
var_InheritFloat
 +
var_InheritString
 +
var_InheritTime
 +
var_InheritAddress
 +
var_InheritURational
  
 
=== var_CreateGet ===
 
=== var_CreateGet ===

Revision as of 21:07, 21 March 2011

Introduction

VLC media player has a powerful "object variable" infrastructure, that can be used to pass information between modules.

It can be compared to an Observer Pattern.

Variable Functions

var_Get

va_Get* functions will get the value if the variable exists (and will error otherwise).

var_Get ( vlc_object_t *, const char *, vlc_value_t * );
var_GetBool( p_obj, psz_name );
var_GetInteger( p_obj, psz_name );
var_GetTime( p_obj, psz_name );
var_GetFloat( p_obj, psz_name );
var_GetString( p_obj, psz_name );
var_GetNonEmptyString( p_obj, psz_name );
var_GetAddress( p_obj, psz_name );

var_Inherit

var_Inherit* functions will get the default value (from configuration, for example) or the one set by the parent object.

var_InheritBool
var_InheritInteger
var_InheritFloat
var_InheritString
var_InheritTime
var_InheritAddress
var_InheritURational

var_CreateGet

var_CreateGet

will create the variable and the get the default value if the variable wasn't already created. If the varible does exist before the call it will get the current value (and increment the refcount).

A variable must be created if you want to add a callback or change the value (with var_Set) of a variable