NVIDIA DeepStream SDK API Reference

9.2 Release
rs2::pipeline Class Reference

Detailed Description

The pipeline simplifies the user interaction with the device and computer vision processing modules.

The class abstracts the camera configuration and streaming, and the vision modules triggering and threading. It lets the application focus on the computer vision output of the modules, or the device output data. The pipeline can manage computer vision modules, which are implemented as a processing blocks. The pipeline is the consumer of the processing block interface, while the application consumes the computer vision interface.

Definition at line 362 of file sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

Public Member Functions

 pipeline (context ctx=context())
 Create a pipeline for processing data from a single device. More...
 
pipeline_profile start ()
 Start the pipeline streaming with its default configuration. More...
 
pipeline_profile start (const config &config)
 Start the pipeline streaming according to the configuraion. More...
 
template<class S >
pipeline_profile start (S callback)
 Start the pipeline streaming with its default configuration. More...
 
template<class S >
pipeline_profile start (const config &config, S callback)
 Start the pipeline streaming according to the configuraion. More...
 
void stop ()
 Stop the pipeline streaming. More...
 
frameset wait_for_frames (unsigned int timeout_ms=RS2_DEFAULT_TIMEOUT) const
 Wait until a new set of frames becomes available. More...
 
bool poll_for_frames (frameset *f) const
 Check if a new set of frames is available and retrieve the latest undelivered set. More...
 
bool try_wait_for_frames (frameset *f, unsigned int timeout_ms=RS2_DEFAULT_TIMEOUT) const
 
pipeline_profile get_active_profile () const
 Return the active device and streams profiles, used by the pipeline. More...
 
 operator std::shared_ptr< rs2_pipeline > () const
 
 pipeline (std::shared_ptr< rs2_pipeline > ptr)
 
 pipeline (context ctx=context())
 Create a pipeline for processing data from a single device. More...
 
pipeline_profile start ()
 Start the pipeline streaming with its default configuration. More...
 
pipeline_profile start (const config &config)
 Start the pipeline streaming according to the configuraion. More...
 
template<class S >
pipeline_profile start (S callback)
 Start the pipeline streaming with its default configuration. More...
 
template<class S >
pipeline_profile start (const config &config, S callback)
 Start the pipeline streaming according to the configuraion. More...
 
void stop ()
 Stop the pipeline streaming. More...
 
frameset wait_for_frames (unsigned int timeout_ms=RS2_DEFAULT_TIMEOUT) const
 Wait until a new set of frames becomes available. More...
 
bool poll_for_frames (frameset *f) const
 Check if a new set of frames is available and retrieve the latest undelivered set. More...
 
bool try_wait_for_frames (frameset *f, unsigned int timeout_ms=RS2_DEFAULT_TIMEOUT) const
 
pipeline_profile get_active_profile () const
 Return the active device and streams profiles, used by the pipeline. More...
 
 operator std::shared_ptr< rs2_pipeline > () const
 
 pipeline (std::shared_ptr< rs2_pipeline > ptr)
 

Friends

class config
 

Constructor & Destructor Documentation

◆ pipeline() [1/4]

rs2::pipeline::pipeline ( context  ctx = context())
inline

Create a pipeline for processing data from a single device.

The caller can provide a context created by the application, usually for playback or testing purposes.

Parameters
[in]ctxThe context allocated by the application. Using the platform context by default.

Definition at line 372 of file sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::error::handle(), rs2_create_pipeline(), and rs2_delete_pipeline().

◆ pipeline() [2/4]

rs2::pipeline::pipeline ( std::shared_ptr< rs2_pipeline >  ptr)
inlineexplicit

◆ pipeline() [3/4]

rs2::pipeline::pipeline ( context  ctx = context())
inline

Create a pipeline for processing data from a single device.

The caller can provide a context created by the application, usually for playback or testing purposes.

Parameters
[in]ctxThe context allocated by the application. Using the platform context by default.

Definition at line 372 of file 9.2/sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::error::handle(), rs2_create_pipeline(), and rs2_delete_pipeline().

◆ pipeline() [4/4]

rs2::pipeline::pipeline ( std::shared_ptr< rs2_pipeline >  ptr)
inlineexplicit

Member Function Documentation

◆ get_active_profile() [1/2]

pipeline_profile rs2::pipeline::get_active_profile ( ) const
inline

Return the active device and streams profiles, used by the pipeline.

The pipeline streams profiles are selected during start(). The method returns a valid result only when the pipeline is active - between calls to start() and stop(). After stop() is called, the pipeline doesn't own the device, thus, the pipeline selected device may change in subsequent activations.

Returns
The actual pipeline device and streams profile, which was successfully configured to the streaming device on start.

Definition at line 571 of file sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::error::handle(), rs2_delete_pipeline_profile(), and rs2_pipeline_get_active_profile().

◆ get_active_profile() [2/2]

pipeline_profile rs2::pipeline::get_active_profile ( ) const
inline

Return the active device and streams profiles, used by the pipeline.

The pipeline streams profiles are selected during start(). The method returns a valid result only when the pipeline is active - between calls to start() and stop(). After stop() is called, the pipeline doesn't own the device, thus, the pipeline selected device may change in subsequent activations.

Returns
The actual pipeline device and streams profile, which was successfully configured to the streaming device on start.

Definition at line 571 of file 9.2/sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::error::handle(), rs2_delete_pipeline_profile(), and rs2_pipeline_get_active_profile().

◆ operator std::shared_ptr< rs2_pipeline >() [1/2]

rs2::pipeline::operator std::shared_ptr< rs2_pipeline > ( ) const
inline

◆ operator std::shared_ptr< rs2_pipeline >() [2/2]

rs2::pipeline::operator std::shared_ptr< rs2_pipeline > ( ) const
inline

◆ poll_for_frames() [1/2]

bool rs2::pipeline::poll_for_frames ( frameset *  f) const
inline

Check if a new set of frames is available and retrieve the latest undelivered set.

The frames set includes time-synchronized frames of each enabled stream in the pipeline. The method returns without blocking the calling thread, with status of new frames available or not. If available, it fetches the latest frames set. Device frames, which were produced while the function wasn't called, are dropped. To avoid frame drops, this method should be called as fast as the device frame rate. The application can maintain the frames handles to defer processing. However, if the application maintains too long history, the device may lack memory resources to produce new frames, and the following calls to this method shall return no new frames, until resources become available.

Parameters
[out]fFrames set handle
Returns
True if new set of time synchronized frames was stored to f, false if no new frames set is available

Definition at line 533 of file 9.2/sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::error::handle(), and rs2_pipeline_poll_for_frames().

◆ poll_for_frames() [2/2]

bool rs2::pipeline::poll_for_frames ( frameset *  f) const
inline

Check if a new set of frames is available and retrieve the latest undelivered set.

The frames set includes time-synchronized frames of each enabled stream in the pipeline. The method returns without blocking the calling thread, with status of new frames available or not. If available, it fetches the latest frames set. Device frames, which were produced while the function wasn't called, are dropped. To avoid frame drops, this method should be called as fast as the device frame rate. The application can maintain the frames handles to defer processing. However, if the application maintains too long history, the device may lack memory resources to produce new frames, and the following calls to this method shall return no new frames, until resources become available.

Parameters
[out]fFrames set handle
Returns
True if new set of time synchronized frames was stored to f, false if no new frames set is available

Definition at line 533 of file sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::error::handle(), and rs2_pipeline_poll_for_frames().

◆ start() [1/8]

pipeline_profile rs2::pipeline::start ( )
inline

Start the pipeline streaming with its default configuration.

The pipeline streaming loop captures samples from the device, and delivers them to the attached computer vision modules and processing blocks, according to each module requirements and threading model. During the loop execution, the application can access the camera streams by calling wait_for_frames() or poll_for_frames(). The streaming loop runs until the pipeline is stopped. Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised.

Returns
The actual pipeline device and streams profile, which was successfully configured to the streaming device.

Definition at line 392 of file 9.2/sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::error::handle(), rs2_delete_pipeline_profile(), and rs2_pipeline_start().

◆ start() [2/8]

pipeline_profile rs2::pipeline::start ( )
inline

Start the pipeline streaming with its default configuration.

The pipeline streaming loop captures samples from the device, and delivers them to the attached computer vision modules and processing blocks, according to each module requirements and threading model. During the loop execution, the application can access the camera streams by calling wait_for_frames() or poll_for_frames(). The streaming loop runs until the pipeline is stopped. Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised.

Returns
The actual pipeline device and streams profile, which was successfully configured to the streaming device.

Definition at line 392 of file sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::error::handle(), rs2_delete_pipeline_profile(), and rs2_pipeline_start().

◆ start() [3/8]

pipeline_profile rs2::pipeline::start ( const config &  config)
inline

Start the pipeline streaming according to the configuraion.

The pipeline streaming loop captures samples from the device, and delivers them to the attached computer vision modules and processing blocks, according to each module requirements and threading model. During the loop execution, the application can access the camera streams by calling wait_for_frames() or poll_for_frames(). The streaming loop runs until the pipeline is stopped. Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised. The pipeline selects and activates the device upon start, according to configuration or a default configuration. When the rs2::config is provided to the method, the pipeline tries to activate the config resolve() result. If the application requests are conflicting with pipeline computer vision modules or no matching device is available on the platform, the method fails. Available configurations and devices may change between config resolve() call and pipeline start, in case devices are connected or disconnected, or another application acquires ownership of a device.

Parameters
[in]configA rs2::config with requested filters on the pipeline configuration. By default no filters are applied.
Returns
The actual pipeline device and streams profile, which was successfully configured to the streaming device.

Definition at line 421 of file sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::config::get(), rs2::error::handle(), rs2_delete_pipeline_profile(), and rs2_pipeline_start_with_config().

◆ start() [4/8]

pipeline_profile rs2::pipeline::start ( const config &  config)
inline

Start the pipeline streaming according to the configuraion.

The pipeline streaming loop captures samples from the device, and delivers them to the attached computer vision modules and processing blocks, according to each module requirements and threading model. During the loop execution, the application can access the camera streams by calling wait_for_frames() or poll_for_frames(). The streaming loop runs until the pipeline is stopped. Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised. The pipeline selects and activates the device upon start, according to configuration or a default configuration. When the rs2::config is provided to the method, the pipeline tries to activate the config resolve() result. If the application requests are conflicting with pipeline computer vision modules or no matching device is available on the platform, the method fails. Available configurations and devices may change between config resolve() call and pipeline start, in case devices are connected or disconnected, or another application acquires ownership of a device.

Parameters
[in]configA rs2::config with requested filters on the pipeline configuration. By default no filters are applied.
Returns
The actual pipeline device and streams profile, which was successfully configured to the streaming device.

Definition at line 421 of file 9.2/sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::config::get(), rs2::error::handle(), rs2_delete_pipeline_profile(), and rs2_pipeline_start_with_config().

◆ start() [5/8]

template<class S >
pipeline_profile rs2::pipeline::start ( const config &  config,
S  callback 
)
inline

Start the pipeline streaming according to the configuraion.

The pipeline captures samples from the device, and delivers them to the provided frame callback. Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised. When starting the pipeline with a callback both wait_for_frames() and poll_for_frames() will throw exception. The pipeline selects and activates the device upon start, according to configuration or a default configuration. When the rs2::config is provided to the method, the pipeline tries to activate the config resolve() result. If the application requests are conflicting with pipeline computer vision modules or no matching device is available on the platform, the method fails. Available configurations and devices may change between config resolve() call and pipeline start, in case devices are connected or disconnected, or another application acquires ownership of a device.

Parameters
[in]configA rs2::config with requested filters on the pipeline configuration. By default no filters are applied.
[in]callbackStream callback, can be any callable object accepting rs2::frame
Returns
The actual pipeline device and streams profile, which was successfully configured to the streaming device.

Definition at line 470 of file sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::config::get(), rs2::error::handle(), rs2_delete_pipeline_profile(), and rs2_pipeline_start_with_config_and_callback_cpp().

◆ start() [6/8]

template<class S >
pipeline_profile rs2::pipeline::start ( const config &  config,
S  callback 
)
inline

Start the pipeline streaming according to the configuraion.

The pipeline captures samples from the device, and delivers them to the provided frame callback. Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised. When starting the pipeline with a callback both wait_for_frames() and poll_for_frames() will throw exception. The pipeline selects and activates the device upon start, according to configuration or a default configuration. When the rs2::config is provided to the method, the pipeline tries to activate the config resolve() result. If the application requests are conflicting with pipeline computer vision modules or no matching device is available on the platform, the method fails. Available configurations and devices may change between config resolve() call and pipeline start, in case devices are connected or disconnected, or another application acquires ownership of a device.

Parameters
[in]configA rs2::config with requested filters on the pipeline configuration. By default no filters are applied.
[in]callbackStream callback, can be any callable object accepting rs2::frame
Returns
The actual pipeline device and streams profile, which was successfully configured to the streaming device.

Definition at line 470 of file 9.2/sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::config::get(), rs2::error::handle(), rs2_delete_pipeline_profile(), and rs2_pipeline_start_with_config_and_callback_cpp().

◆ start() [7/8]

template<class S >
pipeline_profile rs2::pipeline::start ( S  callback)
inline

Start the pipeline streaming with its default configuration.

The pipeline captures samples from the device, and delivers them to the provided frame callback. Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised. When starting the pipeline with a callback both wait_for_frames() and poll_for_frames() will throw exception.

Parameters
[in]callbackStream callback, can be any callable object accepting rs2::frame
Returns
The actual pipeline device and streams profile, which was successfully configured to the streaming device.

Definition at line 442 of file 9.2/sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::error::handle(), rs2_delete_pipeline_profile(), and rs2_pipeline_start_with_callback_cpp().

◆ start() [8/8]

template<class S >
pipeline_profile rs2::pipeline::start ( S  callback)
inline

Start the pipeline streaming with its default configuration.

The pipeline captures samples from the device, and delivers them to the provided frame callback. Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised. When starting the pipeline with a callback both wait_for_frames() and poll_for_frames() will throw exception.

Parameters
[in]callbackStream callback, can be any callable object accepting rs2::frame
Returns
The actual pipeline device and streams profile, which was successfully configured to the streaming device.

Definition at line 442 of file sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::error::handle(), rs2_delete_pipeline_profile(), and rs2_pipeline_start_with_callback_cpp().

◆ stop() [1/2]

void rs2::pipeline::stop ( )
inline

Stop the pipeline streaming.

The pipeline stops delivering samples to the attached computer vision modules and processing blocks, stops the device streaming and releases the device resources used by the pipeline. It is the application's responsibility to release any frame reference it owns. The method takes effect only after start() was called, otherwise an exception is raised.

Definition at line 488 of file 9.2/sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::error::handle(), and rs2_pipeline_stop().

◆ stop() [2/2]

void rs2::pipeline::stop ( )
inline

Stop the pipeline streaming.

The pipeline stops delivering samples to the attached computer vision modules and processing blocks, stops the device streaming and releases the device resources used by the pipeline. It is the application's responsibility to release any frame reference it owns. The method takes effect only after start() was called, otherwise an exception is raised.

Definition at line 488 of file sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::error::handle(), and rs2_pipeline_stop().

◆ try_wait_for_frames() [1/2]

bool rs2::pipeline::try_wait_for_frames ( frameset *  f,
unsigned int  timeout_ms = RS2_DEFAULT_TIMEOUT 
) const
inline

◆ try_wait_for_frames() [2/2]

bool rs2::pipeline::try_wait_for_frames ( frameset *  f,
unsigned int  timeout_ms = RS2_DEFAULT_TIMEOUT 
) const
inline

◆ wait_for_frames() [1/2]

frameset rs2::pipeline::wait_for_frames ( unsigned int  timeout_ms = RS2_DEFAULT_TIMEOUT) const
inline

Wait until a new set of frames becomes available.

The frames set includes time-synchronized frames of each enabled stream in the pipeline. In case of different frame rates of the streams, the frames set include a matching frame of the slow stream, which may have been included in previous frames set. The method blocks the calling thread, and fetches the latest unread frames set. Device frames, which were produced while the function wasn't called, are dropped. To avoid frame drops, this method should be called as fast as the device frame rate. The application can maintain the frames handles to defer processing. However, if the application maintains too long history, the device may lack memory resources to produce new frames, and the following call to this method shall fail to retrieve new frames, until resources become available.

Parameters
[in]timeout_msMax time in milliseconds to wait until an exception will be thrown
Returns
Set of time synchronized frames, one from each active stream

Definition at line 510 of file 9.2/sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::error::handle(), and rs2_pipeline_wait_for_frames().

◆ wait_for_frames() [2/2]

frameset rs2::pipeline::wait_for_frames ( unsigned int  timeout_ms = RS2_DEFAULT_TIMEOUT) const
inline

Wait until a new set of frames becomes available.

The frames set includes time-synchronized frames of each enabled stream in the pipeline. In case of different frame rates of the streams, the frames set include a matching frame of the slow stream, which may have been included in previous frames set. The method blocks the calling thread, and fetches the latest unread frames set. Device frames, which were produced while the function wasn't called, are dropped. To avoid frame drops, this method should be called as fast as the device frame rate. The application can maintain the frames handles to defer processing. However, if the application maintains too long history, the device may lack memory resources to produce new frames, and the following call to this method shall fail to retrieve new frames, until resources become available.

Parameters
[in]timeout_msMax time in milliseconds to wait until an exception will be thrown
Returns
Set of time synchronized frames, one from each active stream

Definition at line 510 of file sources/libs/ds3d/3rdparty/realsense2/include/librealsense2/hpp/rs_pipeline.hpp.

References rs2::error::handle(), and rs2_pipeline_wait_for_frames().

Friends And Related Function Documentation

◆ config


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