OpenNI 1.5.4

#include <XnCppWrapper.h>

Inheritance diagram for xn::Player:

Public Member Functions

 Player (XnNodeHandle hNode=NULL)
 
 Player (const NodeWrapper &other)
 
XnStatus Create (Context &context, const XnChar *strFormatName)
 
XnStatus SetRepeat (XnBool bRepeat)
 
XnStatus SetSource (XnRecordMedium sourceType, const XnChar *strSource)
 
XnStatus GetSource (XnRecordMedium &sourceType, XnChar *strSource, XnUInt32 nBufSize) const
 
XnStatus ReadNext ()
 
XnStatus SeekToTimeStamp (XnInt64 nTimeOffset, XnPlayerSeekOrigin origin)
 
XnStatus SeekToFrame (const XnChar *strNodeName, XnInt32 nFrameOffset, XnPlayerSeekOrigin origin)
 
XnStatus TellTimestamp (XnUInt64 &nTimestamp) const
 
XnStatus TellFrame (const XnChar *strNodeName, XnUInt32 &nFrame) const
 
XnStatus GetNumFrames (const XnChar *strNodeName, XnUInt32 &nFrames) const
 
const XnChar * GetSupportedFormat () const
 
XnStatus EnumerateNodes (NodeInfoList &list) const
 
XnBool IsEOF () const
 
XnStatus RegisterToEndOfFileReached (StateChangedHandler handler, void *pCookie, XnCallbackHandle &hCallback)
 
void UnregisterFromEndOfFileReached (XnCallbackHandle hCallback)
 
XnStatus SetPlaybackSpeed (XnDouble dSpeed)
 
XnDouble GetPlaybackSpeed () const
 
- Public Member Functions inherited from xn::ProductionNode
 ProductionNode (XnNodeHandle hNode=NULL)
 
 ProductionNode (const NodeWrapper &other)
 
NodeInfo GetInfo () const
 
XnStatus AddNeededNode (ProductionNode &needed)
 
XnStatus RemoveNeededNode (ProductionNode &needed)
 
void GetContext (Context &context) const
 
Context GetContext () const
 
XnBool IsCapabilitySupported (const XnChar *strCapabilityName) const
 
XnStatus SetIntProperty (const XnChar *strName, XnUInt64 nValue)
 
XnStatus SetRealProperty (const XnChar *strName, XnDouble dValue)
 
XnStatus SetStringProperty (const XnChar *strName, const XnChar *strValue)
 
XnStatus SetGeneralProperty (const XnChar *strName, XnUInt32 nBufferSize, const void *pBuffer)
 
XnStatus GetIntProperty (const XnChar *strName, XnUInt64 &nValue) const
 
XnStatus GetRealProperty (const XnChar *strName, XnDouble &dValue) const
 
XnStatus GetStringProperty (const XnChar *strName, XnChar *csValue, XnUInt32 nBufSize) const
 
XnStatus GetGeneralProperty (const XnChar *strName, XnUInt32 nBufferSize, void *pBuffer) const
 
XnStatus LockForChanges (XnLockHandle *phLock)
 
void UnlockForChanges (XnLockHandle hLock)
 
XnStatus LockedNodeStartChanges (XnLockHandle hLock)
 
void LockedNodeEndChanges (XnLockHandle hLock)
 
const ErrorStateCapability GetErrorStateCap () const
 
ErrorStateCapability GetErrorStateCap ()
 
GeneralIntCapability GetGeneralIntCap (const XnChar *strCapability)
 
- Public Member Functions inherited from xn::NodeWrapper
 NodeWrapper (XnNodeHandle hNode)
 
 NodeWrapper (const NodeWrapper &other)
 
NodeWrapperoperator= (const NodeWrapper &other)
 
 ~NodeWrapper ()
 
 operator XnNodeHandle () const
 
XnNodeHandle GetHandle () const
 
XnBool operator== (const NodeWrapper &other)
 
XnBool operator!= (const NodeWrapper &other)
 
XnBool IsValid () const
 
const XnChar * GetName () const
 
XnStatus AddRef ()
 
void Release ()
 
void SetHandle (XnNodeHandle hNode)
 
void TakeOwnership (XnNodeHandle hNode)
 

Detailed Description

Purpose: The Player class is used for creating and managing a Player node. This node plays a saved recording of an OpenNI data generation session.

Remarks:

To play a file recording, use the xn::Context::OpenFileRecording() function. OpenNI will open the file, create a mock node for each node in the file, and populate it with the recorded configuration.

An application may take the nodes it needs by calling the xn::Context::FindExistingNode() method, and use them normally.

Note
Nodes created by the player are locked, and cannot be changed, as the configuration must remain according to the recorded configuration.

Applications that initialize OpenNI using an XML file can easily replace their input. This means that instead of reading from a physical device, which generates data in real-time, they read from a recording by replacing the nodes in the XML file with a recording element (see Xml Scripts).

Note
It is not the Player node itself that is generating data. (Accordingly, the Player node does not provide a GetData() method.) The Player node reads data from the file, and "pushes" it into the mock nodes.

Constructor & Destructor Documentation

◆ Player() [1/2]

xn::Player::Player ( XnNodeHandle  hNode = NULL)
inline

Ctor

Parameters
[in]hNodePlayer node handle

◆ Player() [2/2]

xn::Player::Player ( const NodeWrapper other)
inline

Member Function Documentation

◆ Create()

XnStatus xn::Player::Create ( Context context,
const XnChar *  strFormatName 
)
inline

Creates a player node.

Remarks

See Concepts: the Create() Method for a detailed description about the operation of this method.

◆ EnumerateNodes()

XnStatus xn::Player::EnumerateNodes ( NodeInfoList list) const
inline

Retrieves a list of the nodes played by a player. For full details and usage, see xnEnumeratePlayerNodes

◆ GetNumFrames()

XnStatus xn::Player::GetNumFrames ( const XnChar *  strNodeName,
XnUInt32 &  nFrames 
) const
inline

Gets the total number of frames a specific node has in the recording.

Parameters
[in]strNodeNameName of the node for which to retrieve the number of frames.
[out]nFramesRetrieved number of frames.

◆ GetPlaybackSpeed()

XnDouble xn::Player::GetPlaybackSpeed ( ) const
inline

Gets the playback speed.

Returns
Speed ratio, or -1.0 if this node is not a player.

◆ GetSource()

XnStatus xn::Player::GetSource ( XnRecordMedium sourceType,
XnChar *  strSource,
XnUInt32  nBufSize 
) const
inline

Gets the player's source, that is, the type and name of the medium that the recording is played back from.

Parameters
[out]sourceTypePlayer's source type.
[in]strSourcePlayer's source.
[in]nBufSizeSize of the buffer specified by strSource.

◆ GetSupportedFormat()

const XnChar* xn::Player::GetSupportedFormat ( ) const
inline

Gets the name of the format supported by a player. For full details and usage, see xnGetPlayerSupportedFormat

◆ IsEOF()

XnBool xn::Player::IsEOF ( ) const
inline

Returns whether the player is at the end-of-file marker.

Remarks

When Repeat mode is on, this function never returns TRUE. However, the 'End of File Reached' event will be raised during rewind.

◆ ReadNext()

XnStatus xn::Player::ReadNext ( )
inline

Reads the next data element from the player. For full details and usage, see xnPlayerReadNext

◆ RegisterToEndOfFileReached()

XnStatus xn::Player::RegisterToEndOfFileReached ( StateChangedHandler  handler,
void *  pCookie,
XnCallbackHandle hCallback 
)
inline

Registers an event handler for the 'End-Of-File Reached' event.

Parameters
[in]handlerCallback function to be invoked when the event is raised.
[in]pCookieUser's cookie, to be delivered to the callback.
[out]hCallbackHandle to the callback to be used for unregistering it.

For full details and usage of the parameters, see Registering to Events.

◆ SeekToFrame()

XnStatus xn::Player::SeekToFrame ( const XnChar *  strNodeName,
XnInt32  nFrameOffset,
XnPlayerSeekOrigin  origin 
)
inline

Moves the player to a specific frame of a specific played node, e.g., an ImageGenerator node, so that playing will continue from that frame onwards.

Parameters
[in]strNodeNameName of the node.
[in]nFrameOffsetNumber of frames to move, relative to the specified origin. See remarks below.
[in]originOrigin to seek from. See remarks below.

The meaning of the nFrameOffset parameter changes according to the origin parameter:

XN_PLAYER_SEEK_SET: nFrameOffset specifies the total number of frames since the beginning of the node's recording. This must be a positive value.

XN_PLAYER_SEEK_CUR: nFrameOffset specifies the number of frames to move, relative to the current frame of the specified node. A positive value means to move forward, and a negative value means to move backwards.

XN_PLAYER_SEEK_END: nFrameOffset specifies the number of frames to move, relative to the end of the node's recording. This must be a negative value.

You can get different results using this function for different values of strNodeName, because the frame numbers of different nodes are not necessarily in sync.

◆ SeekToTimeStamp()

XnStatus xn::Player::SeekToTimeStamp ( XnInt64  nTimeOffset,
XnPlayerSeekOrigin  origin 
)
inline

Moves the player to a specific time, so that playback will continue from that point onwards.

Parameters
[in]nTimeOffsetOffset to move, relative to the specified origin.
Units in microseconds.
See the remark below.
[in]originOrigin to seek from. See the remarks below.

The meaning of the nTimeOffset parameter changes according to the origin parameter:

XN_PLAYER_SEEK_SET: nTimeOffset specifies the total time passed since the beginning of the recording. This must be a positive value.

XN_PLAYER_SEEK_CUR: nTimeOffset specifies a period of time to move, relative to the current player position. A positive value means to move forward, and a negative value means to move backwards.

XN_PLAYER_SEEK_END: nTimeOffset specifies a period of time to move, relative to the end of the recording. This must be a negative value.

Remarks

For the built-in ONI player, this function is not currently supported and always returns XN_STATUS_NOT_IMPLEMENTED.

◆ SetPlaybackSpeed()

XnStatus xn::Player::SetPlaybackSpeed ( XnDouble  dSpeed)
inline

Sets the player's playback speed, as a ratio of the rate that the recording was made at.

Parameters
[in]dSpeedThe speed ratio.

Values:

dSpeed = 1.0 - Player will try to output frames at the same rate they were recorded (according to their timestamps).

dSpeed > 1.0 - Fast-forward

0 < dSpeed < 1.0 - Slow-motion.

dSpeed = XN_PLAYBACK_SPEED_FASTEST (0.0) - There will be no delay, and frames will be returned immediately on demand.

◆ SetRepeat()

XnStatus xn::Player::SetRepeat ( XnBool  bRepeat)
inline

Specifies whether the player will automatically rewind to the beginning of the recording after reaching the end of the recording.

Parameters
[in]bRepeatDetermines whether the player will repeat or not.

If bRepeat is set to TRUE, the player will automatically rewind when reaching the end.

If bRepeat is set to FALSE, the player will stop playing when reaching the end, and will raise the 'End-Of-File Reached' event. In this state, IsEOF() returns TRUE, and calls to ReadNext() will fail.

◆ SetSource()

XnStatus xn::Player::SetSource ( XnRecordMedium  sourceType,
const XnChar *  strSource 
)
inline

Sets the source for the player, i.e. where the played events will come from. For full details and usage, see xnSetPlayerSource

◆ TellFrame()

XnStatus xn::Player::TellFrame ( const XnChar *  strNodeName,
XnUInt32 &  nFrame 
) const
inline

Gets the current frame number of a specific node played by a player, i.e., the number of frames passed since the beginning of the recording.

Parameters
[in]strNodeNameName of the node.
[out]nFrameRetrieved frame number.

Remarks

Different nodes that belong to the player can have different frame numbers, because the nodes are not necessarily in synchronization.

◆ TellTimestamp()

XnStatus xn::Player::TellTimestamp ( XnUInt64 &  nTimestamp) const
inline

Gets the current time of a player, i.e., the time passed since the beginning of the recording.

Parameters
[out]nTimestampRetrieved timestamp. Units are in microseconds.

◆ UnregisterFromEndOfFileReached()

void xn::Player::UnregisterFromEndOfFileReached ( XnCallbackHandle  hCallback)
inline

Unregisters the event handler for the 'End-Of-File Reached' event.

Parameters
[in]hCallbackHandle received from registration.

For full details and usage of the parameter, see Unregistering from Events .


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