NVIDIA DeepStream SDK API Reference

9.1 Release
sources/libs/nvmsgconv_mega/deepstream_schema/deepstream_schema.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2024-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 
27 #ifndef NVEVENTMSGCONV_H_
28 #define NVEVENTMSGCONV_H_
29 
30 #include "nvdsmeta.h"
31 #include "nvdsmeta_schema.h"
32 #include <iostream>
33 #include <string>
34 #include <unordered_map>
35 
36 using namespace std;
37 
38 #define CONFIG_GROUP_SENSOR "sensor"
39 #define CONFIG_GROUP_PLACE "place"
40 #define CONFIG_GROUP_ANALYTICS "analytics"
41 
42 #define CONFIG_KEY_COORDINATE "coordinate"
43 #define CONFIG_KEY_DESCRIPTION "description"
44 #define CONFIG_KEY_ENABLE "enable"
45 #define CONFIG_KEY_ID "id"
46 #define CONFIG_KEY_LANE "lane"
47 #define CONFIG_KEY_LEVEL "level"
48 #define CONFIG_KEY_LOCATION "location"
49 #define CONFIG_KEY_NAME "name"
50 #define CONFIG_KEY_SOURCE "source"
51 #define CONFIG_KEY_TYPE "type"
52 #define CONFIG_KEY_VERSION "version"
53 
54 
55 #define CONFIG_KEY_PLACE_SUB_FIELD1 "place-sub-field1"
56 #define CONFIG_KEY_PLACE_SUB_FIELD2 "place-sub-field2"
57 #define CONFIG_KEY_PLACE_SUB_FIELD3 "place-sub-field3"
58 
59 #define DEFAULT_CSV_FIELDS 10
60 
61 
62 #define CHECK_ERROR(error) \
63  if (error) { \
64  cout << "Error: " << error->message << endl; \
65  goto done; \
66  }
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
75 struct NvDsPlaceSubObject {
76  string field1;
77  string field2;
78  string field3;
79 };
80 
81 struct NvDsSensorObject {
82  string id;
83  string type;
84  string desc;
85  gdouble location[3];
86  gdouble coordinate[3];
87 };
88 
89 struct NvDsPlaceObject {
90  string id;
91  string name;
92  string type;
93  gdouble location[3];
94  gdouble coordinate[3];
95  NvDsPlaceSubObject subObj;
96 };
97 
98 struct NvDsAnalyticsObject {
99  string id;
100  string desc;
101  string source;
102  string version;
103 };
104 
105 struct NvDs3dDatamap {
106  string obj_key_2d;
107  string obj_key_3d;
108  string obj_key_fusion;
109  string lidar_data_key;
110  guint32 lidar_element_size = 4;
111  guint32 lidar_element_max_points = 10;
112 };
113 
114 struct NvDsPayloadPriv {
115  unordered_map<int, NvDsSensorObject> sensorObj;
116  unordered_map<int, NvDsPlaceObject> placeObj;
117  unordered_map<int, NvDsAnalyticsObject> analyticsObj;
118  NvDs3dDatamap datamapCfg;
119 };
120 
121 gchar* generate_event_message(void* privData, NvDsEventMsgMeta* meta);
122 gchar* generate_event_message_minimal(void* privData, NvDsEvent* events, guint size);
123 gchar* generate_event_message_protobuf(void* privData, NvDsEvent* events, guint size, size_t& message_len);
124 gchar* generate_dsmeta_message(void* privData, void* frameMeta, void* objMeta);
125 gchar* generate_dsmeta_message_minimal(void* privData, void* frameMeta);
126 gchar* generate_dsmeta_message_protobuf(void* privData, void* frameMeta, size_t& message_len);
127 gchar* generate_dsmeta_message_ds3d(void* privData, void* ptrDataMap, gboolean addLidarData, size_t& message_len);
129 void destroy_deepstream_schema_ctx(void* privData);
130 bool nvds_msg2p_parse_key_value(void* privData, const gchar* file);
131 bool nvds_msg2p_parse_csv(void* privData, const gchar* file);
132 bool nvds_msg2p_parse_yaml(void* privData, const gchar* file);
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 #endif /* NVEVENTMSGCONV_H_ */
generate_dsmeta_message_ds3d
gchar * generate_dsmeta_message_ds3d(void *privData, void *ptrDataMap, gboolean addLidarData, size_t &message_len)
NvDsPlaceObject
Definition: sources/libs/nvmsgconv/deepstream_schema/deepstream_schema.h:89
NvDsPlaceSubObject
Store data parsed from the config file in these structures.
Definition: sources/libs/nvmsgconv/deepstream_schema/deepstream_schema.h:75
nvds_msg2p_parse_yaml
bool nvds_msg2p_parse_yaml(void *privData, const gchar *file)
_NvDsEvent
Holds event information.
Definition: sources/includes/nvdsmeta_schema.h:468
generate_dsmeta_message_minimal
gchar * generate_dsmeta_message_minimal(void *privData, void *frameMeta)
generate_dsmeta_message_protobuf
gchar * generate_dsmeta_message_protobuf(void *privData, void *frameMeta, size_t &message_len)
nvds_msg2p_parse_key_value
bool nvds_msg2p_parse_key_value(void *privData, const gchar *file)
generate_event_message_protobuf
gchar * generate_event_message_protobuf(void *privData, NvDsEvent *events, guint size, size_t &message_len)
NvDsSensorObject
Definition: sources/libs/nvmsgconv/deepstream_schema/deepstream_schema.h:81
NvDsEventMsgMeta
Holds event message meta data.
Definition: sources/includes/nvdsmeta_schema.h:394
destroy_deepstream_schema_ctx
void destroy_deepstream_schema_ctx(void *privData)
generate_dsmeta_message
gchar * generate_dsmeta_message(void *privData, void *frameMeta, void *objMeta)
generate_event_message_minimal
gchar * generate_event_message_minimal(void *privData, NvDsEvent *events, guint size)
nvds_msg2p_parse_csv
bool nvds_msg2p_parse_csv(void *privData, const gchar *file)
generate_event_message
gchar * generate_event_message(void *privData, NvDsEventMsgMeta *meta)
NvDs3dDatamap
Definition: sources/libs/nvmsgconv/deepstream_schema/deepstream_schema.h:105
NvDsAnalyticsObject
Definition: sources/libs/nvmsgconv/deepstream_schema/deepstream_schema.h:98
create_deepstream_schema_ctx
void * create_deepstream_schema_ctx()
NvDsPayloadPriv
Definition: sources/libs/nvmsgconv/deepstream_schema/deepstream_schema.h:114