Class frame_source

Class Documentation

class frame_source

The source used to generate frames, which is usually done by the low level driver for each sensor. frame_source is one of the parameters of processing_block’s callback function, which can be used to re-generate the frame and via frame_ready invoke another callback function to notify application frame is ready. Please refer to “video_processing_thread” code snippet in rs-measure.cpp for a detailed usage example.

Public Functions

inline frame allocate_video_frame(const stream_profile &profile, const frame &original, int new_bpp = 0, int new_width = 0, int new_height = 0, int new_stride = 0, rs2_extension frame_type = RS2_EXTENSION_VIDEO_FRAME) const

Allocate a new video frame with given params

Parameters:
  • profile[in] Stream profile going to allocate.

  • original[in] Original frame, if new_bpp, new_width, new_height or new_stride is zero, newly created frame will base on original frame’s metadata to allocate new frame. If frame_type is RS2_EXTENSION_DEPTH_FRAME, the original of the returned frame will be set to it.

  • new_bpp[in] Frame bit per pixel to create.

  • new_width[in] Frame width to create.

  • new_height[in] Frame height to create.

  • new_stride[in] Frame stride to create.

  • frame_type[in] Which frame type are going to create.

Returns:

The allocated frame

inline frame allocate_motion_frame(const stream_profile &profile, const frame &original, rs2_extension frame_type = RS2_EXTENSION_MOTION_FRAME) const

Allocate a new motion frame with given params

Parameters:
  • profile[in] Stream profile going to allocate.

  • original[in] Original frame.

  • frame_type[in] Which frame type are going to create.

Returns:

The allocated frame

inline frame allocate_points(const stream_profile &profile, const frame &original) const
inline frame allocate_composite_frame(std::vector<frame> frames) const

Allocate composite frame with given params

Parameters:

frames[in] Frame vecotor used to create composite frame, the size of composite frame will be the same as vector size.

Returns:

The allocated composite frame

inline void frame_ready(frame result) const

Invoke the callback funtion informing the frame is ready.

Parameters:

frames[in] frame to send to callback function.

Public Members

rs2_source *_source