NVIDIA DeepStream SDK API Reference

6.4 Release
gstdsexample.h
Go to the documentation of this file.
1 
23 #ifndef __GST_DSEXAMPLE_H__
24 #define __GST_DSEXAMPLE_H__
25 
26 #include <gst/base/gstbasetransform.h>
27 #include <gst/video/video.h>
28 
29 /* Open CV headers */
30 #pragma GCC diagnostic push
31 #if __GNUC__ >= 8
32 #pragma GCC diagnostic ignored "-Wclass-memaccess"
33 #endif
34 #ifdef WITH_OPENCV
35 #include "opencv2/imgproc/imgproc.hpp"
36 #include "opencv2/highgui/highgui.hpp"
37 #endif
38 #pragma GCC diagnostic pop
39 
40 #include <cuda.h>
41 #include <cuda_runtime.h>
42 #include "nvbufsurface.h"
43 #include "nvbufsurftransform.h"
44 #include "gst-nvquery.h"
45 #include "gstnvdsmeta.h"
47 
48 /* Package and library details required for plugin_init */
49 #define PACKAGE "dsexample"
50 #define VERSION "1.0"
51 #define LICENSE "Proprietary"
52 #define DESCRIPTION "NVIDIA example plugin for integration with DeepStream on DGPU"
53 #define BINARY_PACKAGE "NVIDIA DeepStream 3rdparty IP integration example plugin"
54 #define URL "http://nvidia.com/"
55 
56 
57 G_BEGIN_DECLS
58 /* Standard boilerplate stuff */
59 typedef struct _GstDsExample GstDsExample;
61 
62 /* Standard boilerplate stuff */
63 #define GST_TYPE_DSEXAMPLE (gst_dsexample_get_type())
64 #define GST_DSEXAMPLE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DSEXAMPLE,GstDsExample))
65 #define GST_DSEXAMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DSEXAMPLE,GstDsExampleClass))
66 #define GST_DSEXAMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_DSEXAMPLE, GstDsExampleClass))
67 #define GST_IS_DSEXAMPLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DSEXAMPLE))
68 #define GST_IS_DSEXAMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DSEXAMPLE))
69 #define GST_DSEXAMPLE_CAST(obj) ((GstDsExample *)(obj))
70 
72 {
73  GstBaseTransform base_trans;
74 
75  // Context of the custom algorithm library
77 
78  // Unique ID of the element. The labels generated by the element will be
79  // updated at index `unique_id` of attr_info array in NvDsObjectParams.
80  guint unique_id;
81 
82  // Frame number of the current input buffer
83  guint64 frame_num;
84 
85  // CUDA Stream used for allocating the CUDA task
87 
88  // Host buffer to store RGB data for use by algorithm
89  void *host_rgb_buf;
90 
91  // the intermediate scratch buffer for conversions RGBA
93 
94 #ifdef WITH_OPENCV
95  // OpenCV mat containing RGB data
96  cv::Mat *cvmat;
97 #endif
98 
99  // Input video info (resolution, color format, framerate, etc)
100  GstVideoInfo video_info;
101 
102  // Resolution at which frames/objects should be processed
105 
106  // Flag which defince igpu/dgpu
108 
109  // Amount of objects processed in single call to algorithm
110  guint batch_size;
111 
112  // GPU ID on which we expect to execute the task
113  guint gpu_id;
114 
115  // Boolean indicating if entire frame or cropped objects should be processed
117 
118  // Boolean indicating if to blur the detected objects
119  gboolean blur_objects;
120 };
121 
122 // Boiler plate stuff
124 {
125  GstBaseTransformClass parent_class;
126 };
127 
128 GType gst_dsexample_get_type (void);
129 
130 G_END_DECLS
131 #endif /* __GST_DSEXAMPLE_H__ */
DsExampleCtx
struct DsExampleCtx DsExampleCtx
Definition: dsexample_lib.h:31
_GstDsExample::process_full_frame
gboolean process_full_frame
Boolean indicating if entire frame or cropped objects should be processed.
Definition: gstdsexample.h:116
NvBufSurface
Holds information about batched buffers.
Definition: nvbufsurface.h:503
_GstDsExample::host_rgb_buf
void * host_rgb_buf
Definition: gstdsexample.h:89
_GstDsExample::processing_width
gint processing_width
Resolution at which frames/objects should be processed.
Definition: gstdsexample.h:103
gst-nvquery.h
_GstDsExample::video_info
GstVideoInfo video_info
Input video info (resolution, color format, framerate, etc)
Definition: gstdsexample.h:100
GstDsExample
typedefG_BEGIN_DECLS struct _GstDsExample GstDsExample
Definition: gstdsexample.h:59
_GstDsExample::gpu_id
guint gpu_id
GPU ID on which we expect to execute the task.
Definition: gstdsexample.h:113
_GstDsExample::cuda_stream
cudaStream_t cuda_stream
CUDA Stream used for allocating the CUDA task.
Definition: gstdsexample.h:86
_GstDsExample::blur_objects
gboolean blur_objects
Definition: gstdsexample.h:119
_GstDsExampleClass
Boiler plate stuff.
Definition: gstdsexample.h:123
_GstDsExample
Definition: gstdsexample.h:71
_GstDsExampleClass::parent_class
GstBaseTransformClass parent_class
Definition: gstdsexample.h:125
cudaStream_t
struct CUstream_st * cudaStream_t
Forward declaration of cudaStream_t.
Definition: nvbufsurftransform.h:29
_GstDsExample::frame_num
guint64 frame_num
Frame number of the current input buffer.
Definition: gstdsexample.h:83
gstnvdsmeta.h
_GstDsExample::unique_id
guint unique_id
Unique ID of the element.
Definition: gstdsexample.h:80
dsexample_lib.h
_GstDsExample::batch_size
guint batch_size
Definition: gstdsexample.h:110
_GstDsExample::inter_buf
NvBufSurface * inter_buf
the intermediate scratch buffer for conversions RGBA
Definition: gstdsexample.h:92
_GstDsExample::base_trans
GstBaseTransform base_trans
Definition: gstdsexample.h:73
_GstDsExample::dsexamplelib_ctx
DsExampleCtx * dsexamplelib_ctx
Context of the custom algorithm library.
Definition: gstdsexample.h:76
gst_dsexample_get_type
GType gst_dsexample_get_type(void)
nvbufsurftransform.h
_GstDsExample::is_integrated
guint is_integrated
Definition: gstdsexample.h:107
nvbufsurface.h
_GstDsExample::processing_height
gint processing_height
Definition: gstdsexample.h:104