libfreenect2 0.4
Open source driver for the Kinect for Windows v2 (K4W2) sensor
Loading...
Searching...
No Matches
TimestampAlignedFrameListener Class Reference

Collect timestamp-aligned combinations of multiple frame types. More...

#include <libfreenect2/frame_listener_impl.h>

Inheritance diagram for TimestampAlignedFrameListener:
FrameListener

Classes

struct  Statistics
 Snapshot of listener delivery and drop counters. More...

Public Member Functions

 TimestampAlignedFrameListener (unsigned int frame_types, uint32_t max_delta_ticks, size_t queue_capacity=8)
virtual ~TimestampAlignedFrameListener ()
bool hasNewFrame () const
 Test whether an aligned frame set is ready.
bool waitForNewFrame (FrameMap &frame, int milliseconds)
 Wait milliseconds for an aligned frame set.
void waitForNewFrame (FrameMap &frame)
 Wait indefinitely for an aligned frame set.
void release (FrameMap &frame)
 Delete all frames in frame.
Statistics getStatistics () const
 Return a thread-safe snapshot of the listener statistics.
virtual bool onNewFrame (Frame::Type type, Frame *frame)
 libfreenect2 calls this function when a new frame is decoded.
Public Member Functions inherited from FrameListener
virtual ~FrameListener ()

Detailed Description

Collect timestamp-aligned combinations of multiple frame types.

Unlike SyncMultiFrameListener, this listener keeps a bounded queue for each subscribed stream and selects the queued combination with the smallest wrap-safe device-timestamp span.

Constructor & Destructor Documentation

◆ TimestampAlignedFrameListener()

TimestampAlignedFrameListener ( unsigned int frame_types,
uint32_t max_delta_ticks,
size_t queue_capacity = 8 )
Parameters
frame_typesUse bitwise or to combine multiple types.
max_delta_ticksLargest accepted device-timestamp span, in 0.125 ms ticks.
queue_capacityMaximum number of queued frames per subscribed type.

Referenced by onNewFrame().

◆ ~TimestampAlignedFrameListener()

virtual ~TimestampAlignedFrameListener ( )
virtual

Member Function Documentation

◆ hasNewFrame()

bool hasNewFrame ( ) const

Test whether an aligned frame set is ready.

Non-blocking.

◆ waitForNewFrame() [1/2]

bool waitForNewFrame ( FrameMap & frame,
int milliseconds )

Wait milliseconds for an aligned frame set.

◆ waitForNewFrame() [2/2]

void waitForNewFrame ( FrameMap & frame)

Wait indefinitely for an aligned frame set.

◆ release()

void release ( FrameMap & frame)

Delete all frames in frame.

◆ getStatistics()

Statistics getStatistics ( ) const

Return a thread-safe snapshot of the listener statistics.

◆ onNewFrame()

virtual bool onNewFrame ( Frame::Type type,
Frame * frame )
virtual

libfreenect2 calls this function when a new frame is decoded.

Parameters
typeType of the new frame.
frameData of the frame.
Returns
true if you want to take ownership of the frame, i.e. reuse/delete it. Will be reused/deleted by caller otherwise.

Implements FrameListener.

References TimestampAlignedFrameListener().