NVIDIA DeepStream SDK API Reference

7.1 Release
gstdsexample.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
13 #ifndef __GST_DSEXAMPLE_H__
14 #define __GST_DSEXAMPLE_H__
15 
16 #include <gst/base/gstbasetransform.h>
17 #include <gst/video/video.h>
18 
19 /* Open CV headers */
20 #pragma GCC diagnostic push
21 #if __GNUC__ >= 8
22 #pragma GCC diagnostic ignored "-Wclass-memaccess"
23 #endif
24 #ifdef WITH_OPENCV
25 #include "opencv2/imgproc/imgproc.hpp"
26 #include "opencv2/highgui/highgui.hpp"
27 #endif
28 #pragma GCC diagnostic pop
29 
30 #include <cuda.h>
31 #include <cuda_runtime.h>
32 #include "nvbufsurface.h"
33 #include "nvbufsurftransform.h"
34 #include "gst-nvquery.h"
35 #include "gstnvdsmeta.h"
37 
38 /* Package and library details required for plugin_init */
39 #define PACKAGE "dsexample"
40 #define VERSION "1.0"
41 #define LICENSE "Proprietary"
42 #define DESCRIPTION "NVIDIA example plugin for integration with DeepStream on DGPU"
43 #define BINARY_PACKAGE "NVIDIA DeepStream 3rdparty IP integration example plugin"
44 #define URL "http://nvidia.com/"
45 
46 
47 G_BEGIN_DECLS
48 /* Standard boilerplate stuff */
49 typedef struct _GstDsExample GstDsExample;
51 
52 /* Standard boilerplate stuff */
53 #define GST_TYPE_DSEXAMPLE (gst_dsexample_get_type())
54 #define GST_DSEXAMPLE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DSEXAMPLE,GstDsExample))
55 #define GST_DSEXAMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DSEXAMPLE,GstDsExampleClass))
56 #define GST_DSEXAMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_DSEXAMPLE, GstDsExampleClass))
57 #define GST_IS_DSEXAMPLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DSEXAMPLE))
58 #define GST_IS_DSEXAMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DSEXAMPLE))
59 #define GST_DSEXAMPLE_CAST(obj) ((GstDsExample *)(obj))
60 
62 #define NVDSEXAMPLE_MAX_BATCH_SIZE 1024
63 
65 {
66  GstBaseTransform base_trans;
67 
68  // Context of the custom algorithm library
70 
71  // Unique ID of the element. The labels generated by the element will be
72  // updated at index `unique_id` of attr_info array in NvDsObjectParams.
73  guint unique_id;
74 
75  // Frame number of the current input buffer
76  guint64 frame_num;
77 
78  // CUDA Stream used for allocating the CUDA task
80 
81  // Host buffer to store RGB data for use by algorithm
82  void *host_rgb_buf;
83 
84  // the intermediate scratch buffer for conversions RGBA
86 
87 #ifdef WITH_OPENCV
88  // OpenCV mat containing RGB data
89  cv::Mat *cvmat;
90 #endif
91 
92  // Input video info (resolution, color format, framerate, etc)
93  GstVideoInfo video_info;
94 
95  // Resolution at which frames/objects should be processed
98 
99  // Flag which defince igpu/dgpu
101 
102  // Maximum batch size
104 
105  // GPU ID on which we expect to execute the task
106  guint gpu_id;
107 
108  // Boolean indicating if entire frame or cropped objects should be processed
110 
111  // Boolean indicating if to blur the detected objects
112  gboolean blur_objects;
113 
116 };
117 
118 // Boiler plate stuff
120 {
121  GstBaseTransformClass parent_class;
122 };
123 
124 GType gst_dsexample_get_type (void);
125 
126 G_END_DECLS
127 #endif /* __GST_DSEXAMPLE_H__ */
DsExampleCtx
struct DsExampleCtx DsExampleCtx
Definition: dsexample_lib.h:21
_GstDsExample::process_full_frame
gboolean process_full_frame
Boolean indicating if entire frame or cropped objects should be processed.
Definition: gstdsexample.h:109
NvBufSurface
Holds information about batched buffers.
Definition: nvbufsurface.h:520
_GstDsExample::host_rgb_buf
void * host_rgb_buf
Definition: gstdsexample.h:82
_GstDsExample::processing_width
gint processing_width
Resolution at which frames/objects should be processed.
Definition: gstdsexample.h:96
gst-nvquery.h
_GstDsExample::video_info
GstVideoInfo video_info
Input video info (resolution, color format, framerate, etc)
Definition: gstdsexample.h:93
GstDsExample
typedefG_BEGIN_DECLS struct _GstDsExample GstDsExample
Definition: gstdsexample.h:49
_GstDsExample::gpu_id
guint gpu_id
GPU ID on which we expect to execute the task.
Definition: gstdsexample.h:106
_GstDsExample::cuda_stream
cudaStream_t cuda_stream
CUDA Stream used for allocating the CUDA task.
Definition: gstdsexample.h:79
_GstDsExample::blur_objects
gboolean blur_objects
Definition: gstdsexample.h:112
_GstDsExampleClass
Boiler plate stuff.
Definition: gstdsexample.h:119
_GstDsExample::max_batch_size
guint max_batch_size
Maximum batch size.
Definition: gstdsexample.h:103
_GstDsExample
Definition: gstdsexample.h:64
_NvBufSurfTransformConfigParams
Holds configuration parameters for a transform/composite session.
Definition: nvbufsurftransform.h:172
_GstDsExampleClass::parent_class
GstBaseTransformClass parent_class
Definition: gstdsexample.h:121
cudaStream_t
struct CUstream_st * cudaStream_t
Forward declaration of cudaStream_t.
Definition: nvbufsurftransform.h:34
_GstDsExample::frame_num
guint64 frame_num
Frame number of the current input buffer.
Definition: gstdsexample.h:76
gstnvdsmeta.h
_GstDsExample::transform_config_params
NvBufSurfTransformConfigParams transform_config_params
Config params required by NvBufSurfTransform API.
Definition: gstdsexample.h:115
_GstDsExample::unique_id
guint unique_id
Unique ID of the element.
Definition: gstdsexample.h:73
dsexample_lib.h
_GstDsExample::inter_buf
NvBufSurface * inter_buf
the intermediate scratch buffer for conversions RGBA
Definition: gstdsexample.h:85
_GstDsExample::base_trans
GstBaseTransform base_trans
Definition: gstdsexample.h:66
_GstDsExample::dsexamplelib_ctx
DsExampleCtx * dsexamplelib_ctx
Context of the custom algorithm library.
Definition: gstdsexample.h:69
gst_dsexample_get_type
GType gst_dsexample_get_type(void)
nvbufsurftransform.h
_GstDsExample::is_integrated
guint is_integrated
Definition: gstdsexample.h:100
nvbufsurface.h
_GstDsExample::processing_height
gint processing_height
Definition: gstdsexample.h:97