xn::Recorder Class Reference
C++ Reference to Application Programmer Interface (API) » Production Nodes Functionality

`#include <XnCppWrapper.h>`

Inheritance diagram for xn::Recorder:
[legend]

## Public Member Functions

| Recorder (XnNodeHandle hNode=NULL)
| Recorder (const NodeWrapper &other)
XnStatus | Create (Context &context, const XnChar *strFormatName=NULL)
XnStatus | SetDestination (XnRecordMedium destType, const XnChar *strDest)
XnStatus | GetDestination (XnRecordMedium &destType, XnChar *strDest, XnUInt32 nBufSize)
XnStatus | AddNodeToRecording (ProductionNode &Node, XnCodecID compression=XN_CODEC_NULL)
XnStatus | RemoveNodeFromRecording (ProductionNode &Node)
XnStatus | Record ()
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)
NodeWrapper & | operator= (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: To create and manage a Recorder node.

Usage: Instatiate and create a Recorder node.

Data output: Records to a specified destination medium the frames of data from each node that was added to the Recorder node.

Remarks:

Recordings are a powerful debug tool. A recording enables a full capture of data generation and the ability to later play it back by 'regeneration' so that applications can simulate an exact replica of the situation to be debugged.

OpenNI supports recordings of the production nodes in the production graph, both the entire configuration of each node, and all data streamed from a node.

OpenNI has a framework for recording data and for playing it back (using mock nodes). It also comes with the nimRecorder module, which defines a new file format (".ONI")

- and implements a Recorder node and a Player node for this format.

If a recorder exists while generating, the 'WaitXUpdateAll' functions automatically record the data from all nodes added to this recorder.

To record, an application creates a Recorder node, and set its destination - the file name to which it should write. The application must add to the Recorder node every production node that it wants to record. When adding a node to the recorder, the Recorder stores its configuration. It also registers to every possible event of the node, so that when any configuration change takes place, it is also recorded.

Once all required nodes are added, the application can read data from the nodes and record it. Recording of data can be achieved either by explicitly calling the xn::Recorder::Record() function, or by using one of the 'UpdateAll' functions.

Applications that initialize OpenNI using an XML file can easily record their session without any change to the code. All that is required is that they create an additional node in the XML file for the recorder, add nodes to it, and when the application calls one of the 'WaitXUpdateAll' functions, recording will occur. see Xml Scripts for explanation on how to do that.

Recordings are played back by using the services of the Player class.

## Constructor & Destructor Documentation

## Recorder() [1/2]

xn::Recorder::Recorder | ( | XnNodeHandle | hNode = NULL | ) |

inline

Ctor

Parameters

  [in] | hNode | A node handle

## Recorder() [2/2]

xn::Recorder::Recorder | ( | const NodeWrapper & | other | ) |

inline

## Member Function Documentation

## AddNodeToRecording()

XnStatus xn::Recorder::AddNodeToRecording | ( | ProductionNode & | Node,
|  | XnCodecID | compression = XN_CODEC_NULL )

inline

Adds a node to the recording setup, and starts recording data what the node generates. This method must be called for each node to be recorded with this recorder.

Parameters

  [in] | Node | Node to add to the recording.
  [in] | compression | Type of compression that will be used to encode the node's data (see XnCodecIDs.h). If XN_CODEC_NULL is specified, a default compression will be chosen according to the node type.

## Create()

XnStatus xn::Recorder::Create | ( | Context & | context,
|  | const XnChar * | strFormatName = NULL )

inline

Creates a Recorder node.

Parameters

  [in] | context | The context in which to create the Recorder node.
  [in] | strFormatName | Optional. The name of the format the recorded file will be in. If NULL, file will be in ONI format.

## GetDestination()

XnStatus xn::Recorder::GetDestination | ( | XnRecordMedium & | destType,
|  | XnChar * | strDest,
|  | XnUInt32 | nBufSize )

inline

Gets the destination medium for the Recorder node to record to.

Parameters

  [out] | destType | The type of medium to record to. Currently only XN_RECORD_MEDIUM_FILE is supported.
  [out] | strDest | Recording destination. If destType is XN_RECORD_MEDIUM_FILE, this specifies a file name.
  [in] | nBufSize | Destination buffer size.

## Record()

XnStatus xn::Recorder::Record | ( |  | ) |

inline

Records one frame of data from each node that was added to the recorder with AddNodeToRecording().

Remarks

To record continually, the recorder node must be called repeatedly for each frame.

It is highly recommended that an application use the 'WaitXUpdateAll' methods, and not call Generator::WaitAndUpdateData() for each generator. When working with the 'WaitXUpdateAll' methods, OpenNI will automatically call Record(), and there is no need for the application to call this method.

## RemoveNodeFromRecording()

XnStatus xn::Recorder::RemoveNodeFromRecording | ( | ProductionNode & | Node | ) |

inline

Removes a node from the Recorder node and stops recording the node output. This function is called on a node that was added to recording with AddNodeToRecording.

Parameters

  [in] | Node | The node to remove from recording.

## SetDestination()

XnStatus xn::Recorder::SetDestination | ( | XnRecordMedium | destType,
|  | const XnChar * | strDest )

inline

Specifies to where the recorder must send its recording. Typically this is a disk file of a particular file type.

Parameters

  [in] | destType | The type of medium to record to. Currently only XN_RECORD_MEDIUM_FILE is supported.
  [in] | strDest | Recording destination. If destType is XN_RECORD_MEDIUM_FILE, this specifies a file name.

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

- XnCppWrapper.h