Documentation
Module internals
| How to Contribute | Index | Data Types |
Module internal
Descriptions
A module can be :
- a output module : like a camera, an output module generate data (no processing.)
- a input module: like tuio, it's an ending module: no data are generated in the tree after the module.
- a input/output module: like an image filter, the data is processed from input, and the result are send on the output.
A module have 2 way to communicate with it :
- properties : every parameters you want configurable by the user. you can even do read-only property for information.
- inputs / outputs : that's the data you can have / generate.
The idea is to make each module independent, without knowing each-others. That's why you must not use a function from another module.
Threading
Our architecture permit to thread or not a module. Your processing will be always done in update() method. This method is called if notifyUpdate() have been asked.
Example of processing in non-threaded mode :
- poll() called by pipeline
- poll() check if update must be called (new data available on input)
- yes, so update() is called
Example of processing in threaded mode :
- poll() called by pipeline
- poll() check if update must be called
- yes, so notify thread to call update()
- thread receive the notify message
- thread call update()
NEVER call update() yourself.
Module methods
Properties
A module will always have default properties as :
- id(str) : the module id (uniq in the whole instance of Movid)
- use_thread(bool) : indicate if the module must be run in threaded mode or not
Methods :
- property(id) : return a moProperty().
- getProperties() : return the list of all properties
Inputs / Outputs
Methods :
- getInputCount() / getOutputCount() : retreive how much input/output are supported by module
- getInputInfos(idx) / getOutputInfox(idx) : retreive information about a specific input/output
- getInput(idx) / getOutput(idx) : get a specific input/output data stream
Run the module
Methods :
- start() : start the module. must be not called twice, without a stop()
- stop() : stop the module. must be not called without a start()
- isStarted() : return true if the module is started.
- poll() : used to poll module internal.
- update() : called to update / process input data
- lock() : lock data of the module
- unlock() : unlock data of the module
Informations
Methods :
- getName() : return the name of the module
- getDescription() : return a whole description of the module
- getAuthor() : return the author that make the module (native = from Movid Core)
- describe() : dump on console all module informations
Errors
Methods :
- haveError() : return true if the module is in an error state
- getLastError() : return the last error, and reset the error state
Controls
Methods :
- notifyUpdate() : notify the module to run update() as soon as possible
- notifyData() : notify the module that new data is available on one input