NVIDIA DeepStream SDK API Reference

6.4 Release
deepstream_common.h File Reference

Go to the source code of this file.

Macros

#define NVGSTDS_ERR_MSG_V(msg, ...)   g_print("** ERROR: <%s:%d>: " msg "\n", __func__, __LINE__, ##__VA_ARGS__)
 
#define NVGSTDS_INFO_MSG_V(msg, ...)   g_print("** INFO: <%s:%d>: " msg "\n", __func__, __LINE__, ##__VA_ARGS__)
 
#define NVGSTDS_WARN_MSG_V(msg, ...)   g_print("** WARN: <%s:%d>: " msg "\n", __func__, __LINE__, ##__VA_ARGS__)
 
#define NVGSTDS_LINK_ELEMENT(elem1, elem2)
 
#define NVGSTDS_LINK_ELEMENT_FULL(elem1, elem1_pad_name, elem2, elem2_pad_name)
 
#define NVGSTDS_BIN_ADD_GHOST_PAD_NAMED(bin, elem, pad, ghost_pad_name)
 
#define NVGSTDS_BIN_ADD_GHOST_PAD(bin, elem, pad)   NVGSTDS_BIN_ADD_GHOST_PAD_NAMED (bin, elem, pad, pad)
 
#define NVGSTDS_ELEM_ADD_PROBE(probe_id, elem, pad, probe_func, probe_type, probe_data)
 
#define NVGSTDS_ELEM_REMOVE_PROBE(probe_id, elem, pad)
 
#define GET_FILE_PATH(path)   ((path) + (((path) && strstr ((path), "file://")) ? 7 : 0))
 

Functions

gboolean link_element_to_tee_src_pad (GstElement *tee, GstElement *sinkelem)
 Function to link sink pad of an element to source pad of tee. More...
 
gboolean link_element_to_streammux_sink_pad (GstElement *streammux, GstElement *elem, gint index)
 Function to link source pad of an element to sink pad of muxer element. More...
 
gboolean unlink_element_from_streammux_sink_pad (GstElement *streammux, GstElement *elem)
 Function to unlink source pad of an element from sink pad of muxer element. More...
 
gboolean link_element_to_demux_src_pad (GstElement *demux, GstElement *elem, guint index)
 Function to link sink pad of an element to source pad of demux element. More...
 
void str_replace (gchar *str, const gchar *replace, const gchar *replace_with)
 

Macro Definition Documentation

◆ GET_FILE_PATH

#define GET_FILE_PATH (   path)    ((path) + (((path) && strstr ((path), "file://")) ? 7 : 0))

Definition at line 121 of file deepstream_common.h.

◆ NVGSTDS_BIN_ADD_GHOST_PAD

#define NVGSTDS_BIN_ADD_GHOST_PAD (   bin,
  elem,
  pad 
)    NVGSTDS_BIN_ADD_GHOST_PAD_NAMED (bin, elem, pad, pad)

Definition at line 91 of file deepstream_common.h.

◆ NVGSTDS_BIN_ADD_GHOST_PAD_NAMED

#define NVGSTDS_BIN_ADD_GHOST_PAD_NAMED (   bin,
  elem,
  pad,
  ghost_pad_name 
)
Value:
do { \
GstPad *gstpad = gst_element_get_static_pad (elem, pad); \
if (!gstpad) { \
NVGSTDS_ERR_MSG_V ("Could not find '%s' in '%s'", pad, \
GST_ELEMENT_NAME(elem)); \
goto done; \
} \
gst_element_add_pad (bin, gst_ghost_pad_new (ghost_pad_name, gstpad)); \
gst_object_unref (gstpad); \
} while (0)

Definition at line 79 of file deepstream_common.h.

◆ NVGSTDS_ELEM_ADD_PROBE

#define NVGSTDS_ELEM_ADD_PROBE (   probe_id,
  elem,
  pad,
  probe_func,
  probe_type,
  probe_data 
)
Value:
do { \
GstPad *gstpad = gst_element_get_static_pad (elem, pad); \
if (!gstpad) { \
NVGSTDS_ERR_MSG_V ("Could not find '%s' in '%s'", pad, \
GST_ELEMENT_NAME(elem)); \
goto done; \
} \
probe_id = gst_pad_add_probe(gstpad, (probe_type), probe_func, probe_data, NULL); \
gst_object_unref (gstpad); \
} while (0)

Definition at line 94 of file deepstream_common.h.

◆ NVGSTDS_ELEM_REMOVE_PROBE

#define NVGSTDS_ELEM_REMOVE_PROBE (   probe_id,
  elem,
  pad 
)
Value:
do { \
if (probe_id == 0 || !elem) { \
break; \
} \
GstPad *gstpad = gst_element_get_static_pad (elem, pad); \
if (!gstpad) { \
NVGSTDS_ERR_MSG_V ("Could not find '%s' in '%s'", pad, \
GST_ELEMENT_NAME(elem)); \
break; \
} \
gst_pad_remove_probe(gstpad, probe_id); \
gst_object_unref (gstpad); \
} while (0)

Definition at line 106 of file deepstream_common.h.

◆ NVGSTDS_ERR_MSG_V

#define NVGSTDS_ERR_MSG_V (   msg,
  ... 
)    g_print("** ERROR: <%s:%d>: " msg "\n", __func__, __LINE__, ##__VA_ARGS__)

Definition at line 35 of file deepstream_common.h.

◆ NVGSTDS_INFO_MSG_V

#define NVGSTDS_INFO_MSG_V (   msg,
  ... 
)    g_print("** INFO: <%s:%d>: " msg "\n", __func__, __LINE__, ##__VA_ARGS__)

Definition at line 38 of file deepstream_common.h.

◆ NVGSTDS_LINK_ELEMENT

#define NVGSTDS_LINK_ELEMENT (   elem1,
  elem2 
)
Value:
do { \
if (!gst_element_link (elem1,elem2)) { \
GstCaps *src_caps, *sink_caps; \
src_caps = gst_pad_query_caps ((GstPad *) (elem1)->srcpads->data, NULL); \
sink_caps = gst_pad_query_caps ((GstPad *) (elem2)->sinkpads->data, NULL); \
NVGSTDS_ERR_MSG_V ("Failed to link '%s' (%s) and '%s' (%s)", \
GST_ELEMENT_NAME (elem1), \
gst_caps_to_string (src_caps), \
GST_ELEMENT_NAME (elem2), \
gst_caps_to_string (sink_caps)); \
goto done; \
} \
} while (0)

Definition at line 44 of file deepstream_common.h.

◆ NVGSTDS_LINK_ELEMENT_FULL

#define NVGSTDS_LINK_ELEMENT_FULL (   elem1,
  elem1_pad_name,
  elem2,
  elem2_pad_name 
)
Value:
do { \
GstPad *elem1_pad = gst_element_get_static_pad(elem1, elem1_pad_name); \
GstPad *elem2_pad = gst_element_get_static_pad(elem2, elem2_pad_name); \
GstPadLinkReturn ret = gst_pad_link (elem1_pad,elem2_pad); \
if (ret != GST_PAD_LINK_OK) { \
gchar *n1 = gst_pad_get_name (elem1_pad); \
gchar *n2 = gst_pad_get_name (elem2_pad); \
NVGSTDS_ERR_MSG_V ("Failed to link '%s' and '%s': %d", \
n1, n2, ret); \
g_free (n1); \
g_free (n2); \
gst_object_unref (elem1_pad); \
gst_object_unref (elem2_pad); \
goto done; \
} \
gst_object_unref (elem1_pad); \
gst_object_unref (elem2_pad); \
} while (0)

Definition at line 59 of file deepstream_common.h.

◆ NVGSTDS_WARN_MSG_V

#define NVGSTDS_WARN_MSG_V (   msg,
  ... 
)    g_print("** WARN: <%s:%d>: " msg "\n", __func__, __LINE__, ##__VA_ARGS__)

Definition at line 41 of file deepstream_common.h.

Function Documentation

◆ link_element_to_demux_src_pad()

gboolean link_element_to_demux_src_pad ( GstElement *  demux,
GstElement *  elem,
guint  index 
)

Function to link sink pad of an element to source pad of demux element.

Parameters
[in]demuxdemuxer element.
[in]elemdownstream element.
[in]indexpad index of demuxer element.
Returns
true if link successful.

◆ link_element_to_streammux_sink_pad()

gboolean link_element_to_streammux_sink_pad ( GstElement *  streammux,
GstElement *  elem,
gint  index 
)

Function to link source pad of an element to sink pad of muxer element.

Parameters
[in]streammuxmuxer element.
[in]elemupstream element.
[in]indexpad index of muxer element.
Returns
true if link successful.

◆ link_element_to_tee_src_pad()

gboolean link_element_to_tee_src_pad ( GstElement *  tee,
GstElement *  sinkelem 
)

Function to link sink pad of an element to source pad of tee.

Parameters
[in]teeTee element.
[in]sinkelemdownstream element.
Returns
true if link successful.

◆ str_replace()

void str_replace ( gchar *  str,
const gchar *  replace,
const gchar *  replace_with 
)

◆ unlink_element_from_streammux_sink_pad()

gboolean unlink_element_from_streammux_sink_pad ( GstElement *  streammux,
GstElement *  elem 
)

Function to unlink source pad of an element from sink pad of muxer element.

Parameters
[in]streammuxmuxer element.
[in]elemupstream element.
Returns
true if unlinking was successful.