Difference between revisions of "Hacker Guide/Variables"

From VideoLAN Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
== Introduction  ==
 
== Introduction  ==
  
{{VLC}} has a powerful "object variable" infrastructure, that can be used to pass information between modules.
+
{{VLC}} has a powerful "object variable" infrastructure, that can be used to pass information between modules.  
  
It can be compared to an [http://en.wikipedia.org/wiki/Observer_pattern Observer Pattern].
+
It can be compared to an [http://en.wikipedia.org/wiki/Observer_pattern Observer Pattern].  
  
== Usage ==
+
== Variable Functions ==
  
var_Get will get the value if the variable exist (error overwise).  
+
var_Get
 +
will get the value if the variable exist (error overwise).  
  
var_Inherit will get the default value or the one setted by the parent object.  
+
var_Inherit
 +
will get the default value or the one setted by the parent object.  
  
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).  
+
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&nbsp;(with var_Set) of a variable <br>
 
A variable must be created if you want to add a callback or change the value&nbsp;(with var_Set) of a variable <br>

Revision as of 21:00, 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

will get the value if the variable exist (error overwise).

var_Inherit

will get the default value or the one setted by the parent object.

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