NVIDIA DeepStream SDK API Reference

6.4 Release
gstnvdsanalytics.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2020-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: MIT
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 #ifndef __GST_NVDSANALYTICS_H__
25 #define __GST_NVDSANALYTICS_H__
26 
27 #include <gst/base/gstbasetransform.h>
28 #include <gst/video/video.h>
29 #include <iostream>
30 #include <vector>
31 #include <unordered_map>
32 #include "nvbufsurface.h"
33 #include "gst-nvquery.h"
34 #include "gstnvdsmeta.h"
35 #include "nvds_analytics.h"
36 #include "nvds_analytics_meta.h"
37 
38 /* Package and library details required for plugin_init */
39 #define PACKAGE "nvdsanalytics"
40 #define VERSION "1.0"
41 #define LICENSE "Proprietary"
42 #define DESCRIPTION "NVIDIA dsanalytics plugin for integration with DeepStream on DGPU/Jetson"
43 #define BINARY_PACKAGE "NVIDIA DeepStream dsanalytics plugin"
44 #define URL "http://nvidia.com/"
45 
46 
47 G_BEGIN_DECLS
48 /* Standard boilerplate stuff */
51 
52 /* Standard boilerplate stuff */
53 #define GST_TYPE_DSANALYTICS (gst_nvdsanalytics_get_type())
54 #define GST_NVDSANALYTICS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DSANALYTICS,GstNvDsAnalytics))
55 #define GST_NVDSANALYTICS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DSANALYTICS,GstNvDsAnalyticsClass))
56 #define GST_NVDSANALYTICS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_DSANALYTICS, GstNvDsAnalyticsClass))
57 #define GST_IS_NVDSANALYTICS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DSANALYTICS))
58 #define GST_IS_NVDSANALYTICS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DSANALYTICS))
59 #define GST_NVDSANALYTICS_CAST(obj) ((GstNvDsAnalytics *)(obj))
60 
62 {
63  GstBaseTransform base_trans;
64 
65  // Context of the custom algorithm library
66  //DsExampleCtx *nvdsanalyticslib_ctx;
67 
68  // Unique ID of the element. The labels generated by the element will be
69  // updated at index `unique_id` of attr_info array in NvDsObjectParams.
70  guint unique_id;
71 
72  // Frame number of the current input buffer
73  guint64 batch_num;
74 
75  // Input video info (resolution, color format, framerate, etc)
76  GstVideoInfo video_info;
77 
78  // Resolution at which analytics algorithms were configured
81 
82  // Amount of objects processed in single call to algorithm
83  guint batch_size;
84 
85  // Config file path for dsanalytics
87 
88  // Config file parsing status for dsanalytics
90 
91  std::unordered_map<gint, StreamInfo> *stream_analytics_info;
92 
93  std::unordered_map<gint, NvDsAnalyticCtxUptr> *stream_analytics_ctx;
94 
96 
97  gboolean enable;
98 
99  //Size of osd font
100  guint font_size;
101 
102  //Type of osd modes, full /partial/completely off
103  guint osd_mode;
104 
105  //Window in ms for obj count
107 
108  gboolean display_obj_cnt;
109 };
110 
111 // Boiler plate stuff
113 {
114  GstBaseTransformClass parent_class;
115 };
116 
117 GType gst_nvdsanalytics_get_type (void);
118 
119 G_END_DECLS
120 #endif /* __GST_NVDSANALYTICS_H__ */
_GstNvDsAnalytics::stream_analytics_ctx
std::unordered_map< gint, NvDsAnalyticCtxUptr > * stream_analytics_ctx
Definition: gstnvdsanalytics.h:93
_GstNvDsAnalytics::configuration_width
gint configuration_width
Definition: gstnvdsanalytics.h:79
_GstNvDsAnalytics::osd_mode
guint osd_mode
Definition: gstnvdsanalytics.h:103
_GstNvDsAnalyticsClass
Definition: gstnvdsanalytics.h:112
gst-nvquery.h
_GstNvDsAnalytics::stream_analytics_info
std::unordered_map< gint, StreamInfo > * stream_analytics_info
Definition: gstnvdsanalytics.h:91
GstNvDsAnalytics
typedefG_BEGIN_DECLS struct _GstNvDsAnalytics GstNvDsAnalytics
Definition: gstnvdsanalytics.h:49
gst_nvdsanalytics_get_type
GType gst_nvdsanalytics_get_type(void)
_GstNvDsAnalytics::analytic_mutex
GMutex analytic_mutex
Definition: gstnvdsanalytics.h:95
nvds_analytics.h
_GstNvDsAnalytics::batch_num
guint64 batch_num
Definition: gstnvdsanalytics.h:73
_GstNvDsAnalytics::config_file_path
gchar * config_file_path
Definition: gstnvdsanalytics.h:86
_GstNvDsAnalytics::unique_id
guint unique_id
Definition: gstnvdsanalytics.h:70
_GstNvDsAnalytics::config_file_parse_successful
gboolean config_file_parse_successful
Definition: gstnvdsanalytics.h:89
_GstNvDsAnalyticsClass::parent_class
GstBaseTransformClass parent_class
Definition: gstnvdsanalytics.h:114
gstnvdsmeta.h
_GstNvDsAnalytics::obj_cnt_win_in_ms
guint obj_cnt_win_in_ms
Definition: gstnvdsanalytics.h:106
_GstNvDsAnalytics::configuration_height
gint configuration_height
Definition: gstnvdsanalytics.h:80
nvds_analytics_meta.h
_GstNvDsAnalytics::video_info
GstVideoInfo video_info
Definition: gstnvdsanalytics.h:76
_GstNvDsAnalytics::display_obj_cnt
gboolean display_obj_cnt
Definition: gstnvdsanalytics.h:108
_GstNvDsAnalytics::font_size
guint font_size
Definition: gstnvdsanalytics.h:100
_GstNvDsAnalytics::batch_size
guint batch_size
Definition: gstnvdsanalytics.h:83
nvbufsurface.h
_GstNvDsAnalytics
Definition: gstnvdsanalytics.h:61
_GstNvDsAnalytics::base_trans
GstBaseTransform base_trans
Definition: gstnvdsanalytics.h:63
_GstNvDsAnalytics::enable
gboolean enable
Definition: gstnvdsanalytics.h:97