OpenViBE Documentation 3.6.0
OpenViBE::Kernel::IPlayer Class Referenceabstract

The main player class. More...

#include <ovIPlayer.h>

+ Inheritance diagram for OpenViBE::Kernel::IPlayer:

Public Member Functions

virtual bool setScenario (const CIdentifier &id, const CNameValuePairList *localConfigTokens=nullptr)=0
 Attaches a scenario to this player. More...
 
virtual IConfigurationManagergetRuntimeConfigurationManager () const =0
 returns a reference to the runtime configuration manager More...
 
virtual IScenarioManagergetRuntimeScenarioManager () const =0
 returns a reference to the runtime scenario manager More...
 
virtual CIdentifier getRuntimeScenarioIdentifier () const =0
 returns the cidentifier of the associated runtime scenario More...
 
virtual EPlayerReturnCodes initialize ()=0
 Initializes this player. More...
 
virtual bool uninitialize ()=0
 Uninitializes this player. More...
 
virtual bool stop ()=0
 Stops player execution. More...
 
virtual bool pause ()=0
 Pauses player execution. More...
 
virtual bool step ()=0
 Executes one more step and pauses. More...
 
virtual bool play ()=0
 Makes player run normal speed. More...
 
virtual bool forward ()=0
 Makes player run as fast as possible. More...
 
virtual EPlayerStatus getStatus () const =0
 Gets current player status. More...
 
virtual bool setFastForwardMaximumFactor (double factor)=0
 Sets maximum fast forward factor coefficient. More...
 
virtual double getFastForwardMaximumFactor () const =0
 Gets the maximum fast forward factor coefficient. More...
 
virtual double getCPUUsage () const =0
 Gets an estimate of the actual time ratio spent in the player's loop. More...
 
virtual bool loop (uint64_t elapsedTime, uint64_t maximumTimeToReach=uint64_t(-1))=0
 "short time" function to be called repeatedly by the outstide application More...
 
virtual uint64_t getCurrentSimulatedTime () const =0
 
- Public Member Functions inherited from OpenViBE::IObject
virtual CIdentifier getClassIdentifier () const =0
 Returns the final class identifier of the concrete class. More...
 
virtual bool isDerivedFromClass (const CIdentifier &classId) const
 Checks if this object is compatible with a class identifier. More...
 
virtual bool acceptVisitor (IObjectVisitor &visitor)
 Requests this object to accept a visitor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from OpenViBE::IObject
virtual ~IObject ()
 

Detailed Description

The main player class.

Author
Yann Renard (INRIA/IRISA)
Date
2006-09-26

A player is responsible for the playback of a specific scenario. This player scenario is provided at initialisation stage and should not be changed until the player terminates. The player idea of calling a "play" function forces the use of threads in order to avoid CPU locking. Thus we prefer the idea of having a "short-time" function that is to be called repeatedly until the player terminates. This is the role of the IPlayer::loop function, that should be called repeatedly by the outside application.

Todo:
Refactor this base class to propose an interface more OpenViBE compliant (use IDs, intialize/unitialize pairs etc...)

Member Function Documentation

◆ setScenario()

virtual bool OpenViBE::Kernel::IPlayer::setScenario ( const CIdentifier id,
const CNameValuePairList localConfigTokens = nullptr 
)
pure virtual

Attaches a scenario to this player.

Parameters
id[in] : the scenario identifier to attach to this player. The scenario itself is found from the scenario manager.
localConfigTokens[in] : An optional map that contains configuration tokens to add.
Returns
true in case of success.
false in case of error.

Implemented in OpenViBE::Kernel::CPlayer.

◆ getRuntimeConfigurationManager()

virtual IConfigurationManager & OpenViBE::Kernel::IPlayer::getRuntimeConfigurationManager ( ) const
pure virtual

returns a reference to the runtime configuration manager

Returns
a reference to the runtime configuration manager

When initialized, a player creates a runtime configuration manager which will be used for scenario and runtime related specific configuration. The use of this features includes the loading of a delayed configuration file for instance. The reference should be valid up to the duration of the player itself.

See also
IConfigurationManager

Implemented in OpenViBE::Kernel::CPlayer.

◆ getRuntimeScenarioManager()

virtual IScenarioManager & OpenViBE::Kernel::IPlayer::getRuntimeScenarioManager ( ) const
pure virtual

returns a reference to the runtime scenario manager

Returns
a reference to the runtime scenario manager

When a scenario is loaded, a copy is made and stored in the runtime scenario manager. This function allows getting the runtime scenario manager that contains the current executed scenario.

See also
IScenarioManager

Implemented in OpenViBE::Kernel::CPlayer.

◆ getRuntimeScenarioIdentifier()

virtual CIdentifier OpenViBE::Kernel::IPlayer::getRuntimeScenarioIdentifier ( ) const
pure virtual

returns the cidentifier of the associated runtime scenario

Returns
the cidentifier of the associated runtime scenario

When initialized, a player copy the scenario in the runtime configuration manager this method allows getting the identifier of said copied scenario

See also
CIdentifier

Implemented in OpenViBE::Kernel::CPlayer.

◆ initialize()

virtual EPlayerReturnCodes OpenViBE::Kernel::IPlayer::initialize ( )
pure virtual

Initializes this player.

Returns
true in case of success.
false in case of error.

Implemented in OpenViBE::Kernel::CPlayer.

◆ uninitialize()

virtual bool OpenViBE::Kernel::IPlayer::uninitialize ( )
pure virtual

Uninitializes this player.

Returns
true in case of success.
false in case of error.

Implemented in OpenViBE::Kernel::CPlayer.

◆ stop()

virtual bool OpenViBE::Kernel::IPlayer::stop ( )
pure virtual

Stops player execution.

Returns
true in case of success.
false in case of error.

Implemented in OpenViBE::Kernel::CPlayer.

◆ pause()

virtual bool OpenViBE::Kernel::IPlayer::pause ( )
pure virtual

Pauses player execution.

Returns
true in case of success.
false in case of error.

Implemented in OpenViBE::Kernel::CPlayer.

◆ step()

virtual bool OpenViBE::Kernel::IPlayer::step ( )
pure virtual

Executes one more step and pauses.

Returns
true in case of success.
false in case of error.

Implemented in OpenViBE::Kernel::CPlayer.

◆ play()

virtual bool OpenViBE::Kernel::IPlayer::play ( )
pure virtual

Makes player run normal speed.

Returns
true in case of success.
false in case of error.

Implemented in OpenViBE::Kernel::CPlayer.

◆ forward()

virtual bool OpenViBE::Kernel::IPlayer::forward ( )
pure virtual

Makes player run as fast as possible.

Returns
true in case of success.
false in case of error.

Implemented in OpenViBE::Kernel::CPlayer.

◆ getStatus()

virtual EPlayerStatus OpenViBE::Kernel::IPlayer::getStatus ( ) const
pure virtual

Gets current player status.

Returns
current player status

Implemented in OpenViBE::Kernel::CPlayer.

◆ setFastForwardMaximumFactor()

virtual bool OpenViBE::Kernel::IPlayer::setFastForwardMaximumFactor ( double  factor)
pure virtual

Sets maximum fast forward factor coefficient.

Parameters
factor: the maximum speed multiplier to be applied when playing in EPlayerStatus::Forward mode
Returns
true in case of success.
false in case of error.
Note
If a negative value is passed, it is turned back to 0
It the fast forward factor is 0, it tells the player to go as fast as possible

Implemented in OpenViBE::Kernel::CPlayer.

◆ getFastForwardMaximumFactor()

virtual double OpenViBE::Kernel::IPlayer::getFastForwardMaximumFactor ( ) const
pure virtual

Gets the maximum fast forward factor coefficient.

Returns
The maximum fast forward factor coefficient.

Implemented in OpenViBE::Kernel::CPlayer.

◆ getCPUUsage()

virtual double OpenViBE::Kernel::IPlayer::getCPUUsage ( ) const
pure virtual

Gets an estimate of the actual time ratio spent in the player's loop.

Returns
the amount of time spent in the player's loop (given in percentage)

Implemented in OpenViBE::Kernel::CPlayer.

◆ loop()

virtual bool OpenViBE::Kernel::IPlayer::loop ( uint64_t  elapsedTime,
uint64_t  maximumTimeToReach = uint64_t(-1) 
)
pure virtual

"short time" function to be called repeatedly by the outstide application

Parameters
elapsedTime[in] : real elapsed time given in seconds 32:32
maximumTimeToReach[in] : maximum time to reach given in seconds 32:32
Returns
true if the execution went successfully.
false in case their was a problem or the execution terminated.

The maximumTimeToReach parameter guarantees that the player does not run beyond the specified time when ran in fast forward mode. It defaults to uint64_t(-1) which represents the largest OpenViBE time.

Implemented in OpenViBE::Kernel::CPlayer.