NVIDIA DeepStream SDK API Reference

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