NVIDIA DeepStream SDK API Reference

8.0 Release
deepstream::Pipeline Class Reference

Detailed Description

Pipeline class definition.

Pipelie class provide the high level interface for most of the functionalities. It is recommended to use Pipeline API for creating applications unless there is some specific features that are only supported in lower level APIs from Element, Object, etc.

Definition at line 46 of file pipeline.hpp.

Inheritance diagram for deepstream::Pipeline:
Collaboration diagram for deepstream::Pipeline:

Data Structures

class  DynamicSourceMessage
 Pipeline message on source add/remove. More...
 
class  EOSMessage
 Pipeline message on EOS. More...
 
class  Message
 base class for pipeline message More...
 
class  StateTransitionMessage
 Pipeline message on state transition. More...
 

Public Types

enum  State {
  INVALID,
  EMPTY,
  READY,
  PAUSED,
  PLAYING
}
 

Public Member Functions

 Pipeline (const char *name)
 
 Pipeline (const char *name, const std::string &config_file)
 Constructor with name and a description file. More...
 
virtual ~Pipeline ()
 Destructor. More...
 
template<typename... Args>
Pipelineadd (const std::string &element_type, const std::string &element_name, const Args &... args)
 Template function for creating and adding element with properties. More...
 
Pipelineadd (Element element)
 Add a given element to the pipeline. More...
 
Elementfind (const ::std::string &name)
 Find an element within the pipeline by name. More...
 
Elementoperator[] (const std::string &name)
 Operator for accessing elements in a pipeline. More...
 
Pipelinelink (std::pair< std::string, std::string > route, std::pair< std::string, std::string > tips)
 Link two elements within the pipeline. More...
 
template<typename... Args>
Pipelinelink (const std::string &arg1, const std::string arg2, const Args &...args)
 Template function for linking elements in the simplest way. More...
 
Pipelineattach (const std::string &elmenent_name, CustomObject *object, const std::string tip="")
 Attach a custom object to an element within the pipeline. More...
 
Pipelineattach (const std::string &element_name, const std::string &plugin_name, const std::string &object_name, const std::string tip="")
 Create and attach a custom object to an element within the pipeline. More...
 
template<typename... Args>
Pipelineattach (const std::string &element_name, const std::string &plugin_name, const std::string &object_name, const std::string tip, const Args &... args)
 Template function for creating and attaching custom object with properties. More...
 
Pipelineinstall (std::function< void(Pipeline &, int key)> keyboard_listener)
 install a callback to capture keyboard events More...
 
int prepare ()
 Intialize the pipeline. More...
 
int prepare (std::function< void(Pipeline &, const Message &)> listener)
 Intialize the pipeline with a callback to capture the messages. More...
 
Pipelinestart ()
 Start the pipeline. More...
 
Pipelinestart (std::function< void(Pipeline &, const Message &)> listener)
 Start the pipeline with a callback to capture the messages. More...
 
Pipelineactivate ()
 Start the pipeline after it is already intialized. More...
 
Pipelinewait ()
 Wait until the pipeline ends. More...
 
Pipelinestop ()
 Stop the pipeline. More...
 
bool isRunning () const
 
Pipelinepause ()
 Pause the pipeline. More...
 
Pipelineresume ()
 Resume the pipeline. More...
 
Pipelineseek (uint64_t timestamp)
 Seek to a specified position for processing data within the pipeline. More...
 
uint32_t startRTSP (uint16_t rtsp_port, uint16_t udp_port, uint32_t buffer_size=0)
 Start an RTSP server. More...
 
void handleKey (int key)
 
const std::string getName () const
 Return the name assigned during the construction. More...
 
 operator bool () const noexcept
 Check if the object is void. More...
 
bool operator== (const Object &other) noexcept
 Check if the two objects are the same. More...
 
GstObjectgive ()
 Give up the ownership and return the opaque pointer. More...
 
GstObjectgetGObject ()
 Return the opaque object pointer. More...
 
Objecttake (GstObject *object)
 Takes the ownership of a object through the opaque pointer. More...
 
Objectseize (GstObject *object)
 Seize a opaque object to prevent it from being destroyed somewhere. More...
 
Objectset (const YAML::Node &params)
 Set the properties from key/value pairs in the yaml format. More...
 
Objectset (const std::string &name, const Value &value)
 
template<typename T , typename... Args>
Objectset (const std::string &name, const T &value, const Args &... args)
 
template<typename T , typename... Args>
ObjectgetProperty (const std::string &name, T &value, Args &... args)
 Template for getting multiple properties. More...
 
std::vector< std::string > listSignals (bool is_action)
 List all the supported signals from the object. More...
 
bool connectSignal (const std::string &signal_name, SignalHandler &handler)
 Connect a signal handler to the object. More...
 
void emitSignal (const std::string &signal_name, va_list args)
 Emit a signal. More...
 

Static Public Member Functions

static unsigned long type ()
 Return the object's type id. More...
 

Protected Member Functions

int run ()
 
int run_after_prepare ()
 
virtual void set_ (const std::string &name, const Value &value)
 
virtual void set_ (const std::string &name, const YAML::Node &value)
 
virtual Value get_ (const std::string &name)
 

Protected Attributes

void * loop_ = NULL
 
uint bus_watch_id_ = 0
 
void * bus_data_ = NULL
 
std::function< void(Pipeline &, int key)> keyboard_listener_
 
std::thread thread_
 
std::map< std::string, Elementelements_
 
std::map< std::string, std::unique_ptr< SignalEmitter > > action_owners_
 
uint64_t start_pts_ = 0
 
GstObjectobject_
 

Member Enumeration Documentation

◆ State

Enumerator
INVALID 
EMPTY 
READY 
PAUSED 
PLAYING 

Definition at line 49 of file pipeline.hpp.

Constructor & Destructor Documentation

◆ Pipeline() [1/2]

deepstream::Pipeline::Pipeline ( const char *  name)

◆ Pipeline() [2/2]

deepstream::Pipeline::Pipeline ( const char *  name,
const std::string &  config_file 
)

Constructor with name and a description file.

◆ ~Pipeline()

virtual deepstream::Pipeline::~Pipeline ( )
virtual

Destructor.

Member Function Documentation

◆ activate()

Pipeline& deepstream::Pipeline::activate ( )

Start the pipeline after it is already intialized.

◆ add() [1/2]

template<typename... Args>
Pipeline& deepstream::Pipeline::add ( const std::string &  element_type,
const std::string &  element_name,
const Args &...  args 
)
inline

Template function for creating and adding element with properties.

Definition at line 129 of file pipeline.hpp.

References deepstream::Object::Element, and deepstream::Object::set().

◆ add() [2/2]

Pipeline& deepstream::Pipeline::add ( Element  element)

Add a given element to the pipeline.

◆ attach() [1/3]

template<typename... Args>
Pipeline& deepstream::Pipeline::attach ( const std::string &  element_name,
const std::string &  plugin_name,
const std::string &  object_name,
const std::string  tip,
const Args &...  args 
)
inline

Template function for creating and attaching custom object with properties.

Definition at line 206 of file pipeline.hpp.

References attach().

◆ attach() [2/3]

Pipeline& deepstream::Pipeline::attach ( const std::string &  element_name,
const std::string &  plugin_name,
const std::string &  object_name,
const std::string  tip = "" 
)

Create and attach a custom object to an element within the pipeline.

Supported custom objects can be buffer probes, signal handlers The custom object will be created through factory

Parameters
[in]element_namename of the elment to which the object attaches
[in]plugin_namename of the plugin where the custom object factory is defined
[in]object_namename of the new custome object
[in]tipsextra information. pad name for buffer probes, signal name for signal handlers

◆ attach() [3/3]

Pipeline& deepstream::Pipeline::attach ( const std::string &  elmenent_name,
CustomObject object,
const std::string  tip = "" 
)

Attach a custom object to an element within the pipeline.

Supported custom objects can be buffer probes, signal handlers Once the object is attached, the element takes the ownership of it

Parameters
[in]element_namename of the elment to which the object attaches
[in]objectpointer to a custom object
[in]tipsextra information. pad name for buffer probes, signal name for signal handlers

Referenced by attach().

◆ connectSignal()

bool deepstream::Object::connectSignal ( const std::string &  signal_name,
SignalHandler handler 
)
inherited

Connect a signal handler to the object.

Parameters
[in]signal_namename of the signal to be connected
[in]handlerhandler for the signal

◆ emitSignal()

void deepstream::Object::emitSignal ( const std::string &  signal_name,
va_list  args 
)
inherited

Emit a signal.

◆ find()

Element* deepstream::Pipeline::find ( const ::std::string &  name)

Find an element within the pipeline by name.

Referenced by operator[]().

◆ get_()

virtual Value deepstream::Object::get_ ( const std::string &  name)
protectedvirtualinherited

◆ getGObject()

GstObject* deepstream::Object::getGObject ( )
inlineinherited

Return the opaque object pointer.

Definition at line 140 of file object.hpp.

References deepstream::Object::object_.

◆ getName()

const std::string deepstream::Object::getName ( ) const
inherited

Return the name assigned during the construction.

◆ getProperty()

template<typename T , typename... Args>
Object& deepstream::Object::getProperty ( const std::string &  name,
T &  value,
Args &...  args 
)
inlineinherited

◆ give()

GstObject* deepstream::Object::give ( )
inherited

Give up the ownership and return the opaque pointer.

◆ handleKey()

void deepstream::Pipeline::handleKey ( int  key)

◆ install()

Pipeline& deepstream::Pipeline::install ( std::function< void(Pipeline &, int key)>  keyboard_listener)
inline

install a callback to capture keyboard events

Definition at line 225 of file pipeline.hpp.

References keyboard_listener_.

◆ isRunning()

bool deepstream::Pipeline::isRunning ( ) const

◆ link() [1/2]

template<typename... Args>
Pipeline& deepstream::Pipeline::link ( const std::string &  arg1,
const std::string  arg2,
const Args &...  args 
)
inline

Template function for linking elements in the simplest way.

Definition at line 165 of file pipeline.hpp.

References link().

◆ link() [2/2]

Pipeline& deepstream::Pipeline::link ( std::pair< std::string, std::string >  route,
std::pair< std::string, std::string >  tips 
)

Link two elements within the pipeline.

Parameters
[in]routea pair with source element name and target element name
[in]tipsextra pair with source pad name and target pad name

Referenced by link().

◆ listSignals()

std::vector<std::string> deepstream::Object::listSignals ( bool  is_action)
inherited

List all the supported signals from the object.

◆ operator bool()

deepstream::Object::operator bool ( ) const
inlineexplicitnoexceptinherited

Check if the object is void.

Definition at line 131 of file object.hpp.

References deepstream::Object::object_.

◆ operator==()

bool deepstream::Object::operator== ( const Object other)
inlinenoexceptinherited

Check if the two objects are the same.

Definition at line 134 of file object.hpp.

References deepstream::Object::object_.

◆ operator[]()

Element& deepstream::Pipeline::operator[] ( const std::string &  name)
inline

Operator for accessing elements in a pipeline.

Definition at line 144 of file pipeline.hpp.

References find().

◆ pause()

Pipeline& deepstream::Pipeline::pause ( )

Pause the pipeline.

◆ prepare() [1/2]

int deepstream::Pipeline::prepare ( )

Intialize the pipeline.

◆ prepare() [2/2]

int deepstream::Pipeline::prepare ( std::function< void(Pipeline &, const Message &)>  listener)

Intialize the pipeline with a callback to capture the messages.

◆ resume()

Pipeline& deepstream::Pipeline::resume ( )

Resume the pipeline.

◆ run()

int deepstream::Pipeline::run ( )
protected

◆ run_after_prepare()

int deepstream::Pipeline::run_after_prepare ( )
protected

◆ seek()

Pipeline& deepstream::Pipeline::seek ( uint64_t  timestamp)

Seek to a specified position for processing data within the pipeline.

◆ seize()

Object& deepstream::Object::seize ( GstObject object)
inherited

Seize a opaque object to prevent it from being destroyed somewhere.

◆ set() [1/3]

template<typename T , typename... Args>
Object& deepstream::Object::set ( const std::string &  name,
const T &  value,
const Args &...  args 
)
inlineinherited

Definition at line 161 of file object.hpp.

References deepstream::Object::set(), and deepstream::Object::set_().

◆ set() [2/3]

Object& deepstream::Object::set ( const std::string &  name,
const Value value 
)
inlineinherited

Definition at line 154 of file object.hpp.

References deepstream::Object::set_().

◆ set() [3/3]

Object& deepstream::Object::set ( const YAML::Node &  params)
inherited

Set the properties from key/value pairs in the yaml format.

Referenced by add(), and deepstream::Object::set().

◆ set_() [1/2]

virtual void deepstream::Object::set_ ( const std::string &  name,
const Value value 
)
protectedvirtualinherited

Reimplemented in deepstream::CustomObject.

Referenced by deepstream::Object::set().

◆ set_() [2/2]

virtual void deepstream::Object::set_ ( const std::string &  name,
const YAML::Node &  value 
)
protectedvirtualinherited

Reimplemented in deepstream::CustomObject.

◆ start() [1/2]

Pipeline& deepstream::Pipeline::start ( )

Start the pipeline.

◆ start() [2/2]

Pipeline& deepstream::Pipeline::start ( std::function< void(Pipeline &, const Message &)>  listener)

Start the pipeline with a callback to capture the messages.

◆ startRTSP()

uint32_t deepstream::Pipeline::startRTSP ( uint16_t  rtsp_port,
uint16_t  udp_port,
uint32_t  buffer_size = 0 
)

Start an RTSP server.

◆ stop()

Pipeline& deepstream::Pipeline::stop ( )

Stop the pipeline.

◆ take()

Object& deepstream::Object::take ( GstObject object)
inherited

Takes the ownership of a object through the opaque pointer.

◆ type()

static unsigned long deepstream::Object::type ( )
staticinherited

Return the object's type id.

◆ wait()

Pipeline& deepstream::Pipeline::wait ( )

Wait until the pipeline ends.

Field Documentation

◆ action_owners_

std::map<std::string, std::unique_ptr<SignalEmitter> > deepstream::Pipeline::action_owners_
protected

Definition at line 278 of file pipeline.hpp.

◆ bus_data_

void* deepstream::Pipeline::bus_data_ = NULL
protected

Definition at line 270 of file pipeline.hpp.

◆ bus_watch_id_

uint deepstream::Pipeline::bus_watch_id_ = 0
protected

Definition at line 268 of file pipeline.hpp.

◆ elements_

std::map<std::string, Element> deepstream::Pipeline::elements_
protected

Definition at line 276 of file pipeline.hpp.

◆ keyboard_listener_

std::function<void(Pipeline&, int key)> deepstream::Pipeline::keyboard_listener_
protected

Definition at line 271 of file pipeline.hpp.

Referenced by install().

◆ loop_

void* deepstream::Pipeline::loop_ = NULL
protected

Definition at line 266 of file pipeline.hpp.

◆ object_

GstObject* deepstream::Object::object_
protectedinherited

◆ start_pts_

uint64_t deepstream::Pipeline::start_pts_ = 0
protected

Definition at line 280 of file pipeline.hpp.

◆ thread_

std::thread deepstream::Pipeline::thread_
protected

Definition at line 274 of file pipeline.hpp.


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