Ocean
Ocean::Devices::DevicePlayer Class Referenceabstract

This class implements the abstract base class for all device players. More...

Public Types

enum  TransformationResult : uint32_t { TR_DOES_NOT_EXIST = 0u , TR_INTERPOLATED , TR_PRECISE }
 Definition of individual transformation results. More...
 

Public Member Functions

 DevicePlayer ()=default
 Creates a new device player. More...
 
virtual ~DevicePlayer ()
 Destructs the device player. More...
 
virtual bool initialize (const std::string &filename)=0
 Initializes the player with a recording. More...
 
virtual bool start (const float speed=1.0f)=0
 Starts the replay. More...
 
virtual bool stop ()=0
 Stops the replay. More...
 
virtual Timestamp playNextFrame ()=0
 Plays the next frame of the recording, the player must be started with stop-motion mode ('SPEED_USE_STOP_MOTION'). More...
 
virtual double duration () const =0
 Returns the duration of the content when played with default speed. More...
 
virtual Media::FrameMediumRefs frameMediums ()
 Returns all frame media objects which have been created based on the recording. More...
 
virtual TransformationResult transformation (const std::string &name, const Timestamp &timestamp, HomogenousMatrixD4 &matrix)=0
 Returns a specific transformation which is expected to be part of the recording. More...
 
virtual bool isStarted () const =0
 Returns whether this player is currently started. More...
 
virtual bool isValid () const
 Returns whether this player holds a valid recording. More...
 

Static Public Attributes

static constexpr float SPEED_USE_STOP_MOTION = 0.0f
 Definition of a speed value for the stop-motion replay mode. More...
 

Protected Attributes

std::string filename_
 The filename of the recording which is used. More...
 
Lock lock_
 The player's lock. More...
 

Detailed Description

This class implements the abstract base class for all device players.

The device player can be used to re-play a previously captured data and exposing the data through devices.

Member Enumeration Documentation

◆ TransformationResult

Definition of individual transformation results.

Enumerator
TR_DOES_NOT_EXIST 

The transformation does not exist in the recording.

TR_INTERPOLATED 

The resulting transformation is valid but interpolated due to a not perfectly matching timestamp.

TR_PRECISE 

The resulting transformation is valid and the timestamp matched perfectly with a transformation in the recording.

Constructor & Destructor Documentation

◆ DevicePlayer()

Ocean::Devices::DevicePlayer::DevicePlayer ( )
default

Creates a new device player.

◆ ~DevicePlayer()

virtual Ocean::Devices::DevicePlayer::~DevicePlayer ( )
virtual

Destructs the device player.

Member Function Documentation

◆ duration()

virtual double Ocean::Devices::DevicePlayer::duration ( ) const
pure virtual

Returns the duration of the content when played with default speed.

Returns
The recording's default duration, in seconds, with range [0, infinity)

◆ frameMediums()

virtual Media::FrameMediumRefs Ocean::Devices::DevicePlayer::frameMediums ( )
virtual

Returns all frame media objects which have been created based on the recording.

Returns
The media objects, empty if the recording does not contain any frame medium objects

◆ initialize()

virtual bool Ocean::Devices::DevicePlayer::initialize ( const std::string &  filename)
pure virtual

Initializes the player with a recording.

Parameters
filenameThe name of the file to be used in the player, must be valid
Returns
True, if succeeded

◆ isStarted()

virtual bool Ocean::Devices::DevicePlayer::isStarted ( ) const
pure virtual

Returns whether this player is currently started.

Returns
True, if so

◆ isValid()

virtual bool Ocean::Devices::DevicePlayer::isValid ( ) const
virtual

Returns whether this player holds a valid recording.

Returns
True, if so

◆ playNextFrame()

virtual Timestamp Ocean::Devices::DevicePlayer::playNextFrame ( )
pure virtual

Plays the next frame of the recording, the player must be started with stop-motion mode ('SPEED_USE_STOP_MOTION').

In case the recording holds several media objects, the fist media objects is used to identify the next frame.
This function will read all records which have been recorded before or at the same time as the next frame of the first media object.
If the recording does not have any media object nothing happens.

Returns
The timestamp of the frame which has been played, invalid if no additional frame exists
See also
start(), frameMediums().

◆ start()

virtual bool Ocean::Devices::DevicePlayer::start ( const float  speed = 1.0f)
pure virtual

Starts the replay.

The recording can be payed with individual speed, e.g., real-time, slower than real-time, faster than real-time.
Further, the player support a stop-motion mode in which the player will play one frame by another.

Parameters
speedThe speed at which the recording will be played, e.g., 2 means two times faster than normal, with range (0, infinity), 'SPEED_USE_STOP_MOTION' to play the recording in a stop-motion (frame by frame) mode
Returns
True, if succeeded
See also
duration(), playNextFrame();

◆ stop()

virtual bool Ocean::Devices::DevicePlayer::stop ( )
pure virtual

Stops the replay.

Returns
True, if succeeded

◆ transformation()

virtual TransformationResult Ocean::Devices::DevicePlayer::transformation ( const std::string &  name,
const Timestamp timestamp,
HomogenousMatrixD4 matrix 
)
pure virtual

Returns a specific transformation which is expected to be part of the recording.

This function is intended as a helper function to simplify access to important transformations which otherwise would be accessed through the player's tracking devices.

Parameters
nameThe name of the transformation, must be valid
timestampThe timestamp for which the transformation is evaluated, must be valid
matrixThe resulting transformation matrix
Returns
The transformation result

Field Documentation

◆ filename_

std::string Ocean::Devices::DevicePlayer::filename_
protected

The filename of the recording which is used.

◆ lock_

Lock Ocean::Devices::DevicePlayer::lock_
mutableprotected

The player's lock.

◆ SPEED_USE_STOP_MOTION

constexpr float Ocean::Devices::DevicePlayer::SPEED_USE_STOP_MOTION = 0.0f
staticconstexpr

Definition of a speed value for the stop-motion replay mode.


The documentation for this class was generated from the following file: