Class frame_queue

Class Documentation

class frame_queue

Public Functions

inline explicit frame_queue(unsigned int capacity, bool keep_frames = false)

create frame queue. frame queues are the simplest x-platform synchronization primitive provided by librealsense to help developers who are not using async APIs param[in] capacity size of the frame queue param[in] keep_frames if set to true, the queue automatically calls keep() on every frame enqueued into it.

inline frame_queue()
inline void enqueue(frame f) const

enqueue new frame into the queue

Parameters:

f[in] - frame handle to enqueue (this operation passed ownership to the queue)

inline frame wait_for_frame(unsigned int timeout_ms = 5000) const

wait until new frame becomes available in the queue and dequeue it

Returns:

frame handle to be released using rs2_release_frame

template<typename T>
inline std::enable_if<std::is_base_of<rs2::frame, T>::value, bool>::type poll_for_frame(T *output) const

poll if a new frame is available and dequeue if it is

Parameters:

f[out] - frame handle

Returns:

true if new frame was stored to f

template<typename T>
inline std::enable_if<std::is_base_of<rs2::frame, T>::value, bool>::type try_wait_for_frame(T *output, unsigned int timeout_ms = 5000) const
inline void operator()(frame f) const

Does the same thing as enqueue function.

inline size_t size() const

Return the capacity of the queue

Returns:

capacity size

inline size_t capacity() const

Return the capacity of the queue

Returns:

capacity size

inline bool keep_frames() const

Return whether or not the queue calls keep on enqueued frames

Returns:

keeping frames

inline std::shared_ptr<rs2_frame_queue> get()

Provide a getter for underlying rs2_frame_queue object. Used to invoke C-API that require C-type parameters in signature

Returns:

keeping frames