NVIDIA DeepStream SDK API Reference

8.0 Release
deepstream::Element Class Reference

Detailed Description

Element class definition.

Element class derives from the Object class and is a reference based wrapper, supporting copying and moving.

Definition at line 49 of file element.hpp.

Inheritance diagram for deepstream::Element:
Collaboration diagram for deepstream::Element:

Public Types

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

Public Member Functions

 Element (const std::string &type_name, std::string name=std::string())
 Constructor. More...
 
 Element (const Object &)
 Downcast copy constructor from Object class. More...
 
 Element (Object &&)
 Downcast move constructor from Object class. More...
 
virtual ~Element ()
 Destructor. More...
 
Elementlink (Element &dst, std::pair< std::string, std::string > hint)
 Link two Element instances using hint. More...
 
Elementlink (Element &other)
 Link two Element instances directly. More...
 
BufferProbegetProbe (const std::string &name)
 Find the buffer probe attached to the elmenent by name. More...
 
ElementaddProbe (const std::string &plugin_name, const std::string &probe_name, const std::string probe_tip="")
 Create and add a buffer probe to the element. More...
 
template<typename... Args>
ElementaddProbe (const std::string &plugin_name, const std::string &probe_name, const std::string probe_tip="", const Args &... args)
 Template function for creating and adding buffer probe with properties. More...
 
ElementaddProbe (BufferProbe *probe, const std::string probe_tip="")
 Add a BufferProbe instance to the element. More...
 
SignalHandlergetSignalHandler (const std::string &name)
 Find the signal handler attached to the element by name. More...
 
ElementconnectSignal (const std::string &signal_name, SignalHandler *handler)
 Connect a signal handler to the element. More...
 
ElementconnectSignal (const std::string &plugin_name, const std::string &handler_name, const std::string &signal_names)
 Create and connect a handler to element's signal. More...
 
template<typename... Args>
ElementconnectSignal (const std::string &plugin_name, const std::string &handler_name, const std::string &signal_names, const Args &... args)
 Template function for creating and connecting signal with properties. More...
 
const PipelinegetPipeline ()
 
bool setState (Element::State state)
 Set the Element in particular state. More...
 
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

 Element (GstObject *object)
 
Elementadd_ (CustomObject *object)
 
template<class T >
T * find_ (const std::string &name)
 
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

std::shared_ptr< std::unordered_map< std::string, std::unique_ptr< CustomObject > > > objects_
 
Pipelinepipeline_ =nullptr
 
GstObjectobject_
 

Friends

class Pipeline
 

Member Enumeration Documentation

◆ State

Enumerator
INVALID 
EMPTY 
READY 
PAUSED 
PLAYING 

Definition at line 52 of file element.hpp.

Constructor & Destructor Documentation

◆ Element() [1/4]

deepstream::Element::Element ( const std::string &  type_name,
std::string  name = std::string() 
)

Constructor.

Parameters
[in]type_nameehe type name for a specific element defined with Deepstream SDK
[in]namename given to the Element instance

◆ Element() [2/4]

deepstream::Element::Element ( const Object )

Downcast copy constructor from Object class.

◆ Element() [3/4]

deepstream::Element::Element ( Object &&  )

Downcast move constructor from Object class.

◆ ~Element()

virtual deepstream::Element::~Element ( )
virtual

Destructor.

◆ Element() [4/4]

deepstream::Element::Element ( GstObject object)
protected

Member Function Documentation

◆ add_()

Element& deepstream::Element::add_ ( CustomObject object)
protected

◆ addProbe() [1/3]

Element& deepstream::Element::addProbe ( BufferProbe probe,
const std::string  probe_tip = "" 
)

Add a BufferProbe instance to the element.

Once the probe is added, the element will take the ownership

Parameters
[in]probepointer to the buffer probe
[in]probe_tipextra information for adding the probe, e.g name of the pad

◆ addProbe() [2/3]

Element& deepstream::Element::addProbe ( const std::string &  plugin_name,
const std::string &  probe_name,
const std::string  probe_tip = "" 
)

Create and add a buffer probe to the element.

A buffer probe will be automatically created by the factory in the plugin.

Parameters
[in]plugin_namename of the plugin where the factory for the buffer probe is defined
[in]probe_namename of the buffer probe to be added
[in]probe_tipextra information for adding the probe, e.g name of the pad

Referenced by addProbe().

◆ addProbe() [3/3]

template<typename... Args>
Element& deepstream::Element::addProbe ( const std::string &  plugin_name,
const std::string &  probe_name,
const std::string  probe_tip = "",
const Args &...  args 
)
inline

Template function for creating and adding buffer probe with properties.

Definition at line 115 of file element.hpp.

References addProbe(), and getProbe().

◆ connectSignal() [1/4]

Element& deepstream::Element::connectSignal ( const std::string &  plugin_name,
const std::string &  handler_name,
const std::string &  signal_names 
)

Create and connect a handler to element's signal.

A signal handler will be created automatically by the factory defined in the plugin

Parameters
[in]plugin_namename of the plugin where the factory of the signal handler is defined
[in]handler_namename of the signal handler to be added
[in]signal_namesnames of the signals for the handler to connect, separated by "/"

◆ connectSignal() [2/4]

template<typename... Args>
Element& deepstream::Element::connectSignal ( const std::string &  plugin_name,
const std::string &  handler_name,
const std::string &  signal_names,
const Args &...  args 
)
inline

Template function for creating and connecting signal with properties.

Definition at line 175 of file element.hpp.

References connectSignal(), and getSignalHandler().

◆ connectSignal() [3/4]

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

◆ connectSignal() [4/4]

Element& deepstream::Element::connectSignal ( const std::string &  signal_name,
SignalHandler handler 
)

Connect a signal handler to the element.

A signal handler is responsible for handling the asynchronous signals emitted from the element. Signals behave like events and are defined by their names. Detailed information of signal types available within an element can be found from the Plugin Manual of Deepstream.

Once connected, the element takes the ownership of the signal handler

Parameters
[in]signal_namename of the signal to which the handler is connected
[in]probe_tippointer to the signal handler

Referenced by connectSignal().

◆ emitSignal()

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

Emit a signal.

◆ find_()

template<class T >
T* deepstream::Element::find_ ( const std::string &  name)
inlineprotected

Definition at line 206 of file element.hpp.

References objects_.

◆ 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.

◆ getPipeline()

const Pipeline& deepstream::Element::getPipeline ( )
inline

Definition at line 187 of file element.hpp.

References pipeline_.

◆ getProbe()

BufferProbe* deepstream::Element::getProbe ( const std::string &  name)
inline

Find the buffer probe attached to the elmenent by name.

Definition at line 95 of file element.hpp.

Referenced by addProbe().

◆ getProperty()

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

◆ getSignalHandler()

SignalHandler* deepstream::Element::getSignalHandler ( const std::string &  name)
inline

Find the signal handler attached to the element by name.

Definition at line 139 of file element.hpp.

Referenced by connectSignal().

◆ give()

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

Give up the ownership and return the opaque pointer.

◆ link() [1/2]

Element& deepstream::Element::link ( Element dst,
std::pair< std::string, std::string >  hint 
)

Link two Element instances using hint.

Parameters
[in]dsttarget element to which this element links
[in]hinthint for the link, providing the source pad name and target pad name
Returns
target element

◆ link() [2/2]

Element& deepstream::Element::link ( Element other)

Link two Element instances directly.

Parameters
[in]dsttarget element to which this element links
Returns
target element

◆ 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_.

◆ 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 deepstream::Pipeline::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.

◆ setState()

bool deepstream::Element::setState ( Element::State  state)

Set the Element in particular state.

◆ 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.

Friends And Related Function Documentation

◆ Pipeline

friend class Pipeline
friend

Definition at line 218 of file element.hpp.

Field Documentation

◆ object_

GstObject* deepstream::Object::object_
protectedinherited

◆ objects_

std::shared_ptr<std::unordered_map<std::string, std::unique_ptr<CustomObject> > > deepstream::Element::objects_
protected

Definition at line 201 of file element.hpp.

Referenced by find_().

◆ pipeline_

Pipeline* deepstream::Element::pipeline_ =nullptr
protected

Definition at line 203 of file element.hpp.

Referenced by getPipeline().


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