deepstream_config_file_parser.h 12.2 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
/*
 * SPDX-FileCopyrightText: Copyright (c) 2018-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
 *
 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
 * property and proprietary rights in and to this material, related
 * documentation and any modifications thereto. Any use, reproduction,
 * disclosure or distribution of this material and related documentation
 * without an express license agreement from NVIDIA CORPORATION or
 * its affiliates is strictly prohibited.
 */

#ifndef __NVGSTDS_CONFIG_PARSER_H__
#define  __NVGSTDS_CONFIG_PARSER_H__

#include <gst/gst.h>

#ifdef __cplusplus
extern "C"
{
#endif

#include "deepstream_config.h"
#include "deepstream_sources.h"
#include "deepstream_preprocess.h"
#include "deepstream_primary_gie.h"
#include "deepstream_audio_classifier.h"
#include "deepstream_tiled_display.h"
#include "deepstream_gie.h"
#include "deepstream_sinks.h"
#include "deepstream_osd.h"
#include "deepstream_segvisual.h"
#include "deepstream_sources.h"
#include "deepstream_dsanalytics.h"
#include "deepstream_dsexample.h"
#include "deepstream_streammux.h"
#include "deepstream_tracker.h"
#include "deepstream_dewarper.h"
#include "deepstream_c2d_msg.h"
#include "deepstream_image_save.h"

#define CONFIG_GROUP_SOURCE_LIST "source-list"
#define CONFIG_GROUP_SOURCE_LIST_NUM_SOURCE_BINS "num-source-bins"
#define CONFIG_GROUP_SOURCE_LIST_URI_LIST "list"
/** this vector is one to one mapped with the uri-list/list */
#define CONFIG_GROUP_SOURCE_LIST_SENSOR_ID_LIST "sensor-id-list"
#define CONFIG_GROUP_SOURCE_LIST_SENSOR_NAME_LIST "sensor-name-list"

/** additional configs to support nvmultiurisrcbin usage */
#define CONFIG_GROUP_SOURCE_LIST_USE_NVMULTIURISRCBIN "use-nvmultiurisrcbin"
#define CONFIG_GROUP_SOURCE_LIST_STREAM_NAME_DISPLAY "stream-name-display"
#define CONFIG_GROUP_SOURCE_LIST_MAX_BATCH_SIZE "max-batch-size"
#define CONFIG_GROUP_SOURCE_LIST_HTTP_IP "http-ip"
#define CONFIG_GROUP_SOURCE_LIST_HTTP_PORT "http-port"
#define CONFIG_GROUP_SOURCE_EXTRACT_SEI_TYPE5_DATA "extract-sei-type5-data"
#define CONFIG_GROUP_SOURCE_SEI_UUID "sei-uuid"
#define CONFIG_GROUP_SOURCE_LIST_LOW_LATENCY_MODE "low-latency-mode"

#define CONFIG_GROUP_SOURCE_ALL "source-attr-all"

#define CONFIG_GROUP_SOURCE "source"
#define CONFIG_GROUP_OSD "osd"
#define CONFIG_GROUP_SEGVISUAL "segvisual"
#define CONFIG_GROUP_PREPROCESS "pre-process"
#define CONFIG_GROUP_SECONDARY_PREPROCESS "secondary-pre-process"
#define CONFIG_GROUP_PRIMARY_GIE "primary-gie"
#define CONFIG_GROUP_SECONDARY_GIE "secondary-gie"
#define CONFIG_GROUP_TRACKER "tracker"
#define CONFIG_GROUP_SINK "sink"
#define CONFIG_GROUP_TILED_DISPLAY "tiled-display"
#define CONFIG_GROUP_DSANALYTICS "nvds-analytics"
#define CONFIG_GROUP_DSEXAMPLE "ds-example"
#define CONFIG_GROUP_STREAMMUX "streammux"
#define CONFIG_GROUP_DEWARPER "dewarper"
#define CONFIG_GROUP_MSG_CONVERTER  "message-converter"
#define CONFIG_GROUP_MSG_CONSUMER  "message-consumer"
#define CONFIG_GROUP_IMG_SAVE "img-save"
#define CONFIG_GROUP_AUDIO_TRANSFORM "audio-transform"
#define CONFIG_GROUP_AUDIO_CLASSIFIER "audio-classifier"

#define CONFIG_GROUP_SOURCE_GPU_ID "gpu-id"
#define CONFIG_GROUP_SOURCE_TYPE "type"
#define CONFIG_GROUP_SOURCE_CUDA_MEM_TYPE "nvbuf-memory-type"
#define CONFIG_GROUP_SOURCE_CAMERA_WIDTH "camera-width"
#define CONFIG_GROUP_SOURCE_CAMERA_HEIGHT "camera-height"
#define CONFIG_GROUP_SOURCE_CAMERA_FPS_N "camera-fps-n"
#define CONFIG_GROUP_SOURCE_CAMERA_FPS_D "camera-fps-d"
#define CONFIG_GROUP_SOURCE_CAMERA_CSI_SID "camera-csi-sensor-id"
#define CONFIG_GROUP_SOURCE_CAMERA_V4L2_DEVNODE "camera-v4l2-dev-node"
#define CONFIG_GROUP_SOURCE_URI "uri"
#define CONFIG_GROUP_SOURCE_LIVE_SOURCE "live-source"
#define CONFIG_GROUP_SOURCE_FILE_LOOP "file-loop"
#define CONFIG_GROUP_SOURCE_LATENCY "latency"
#define CONFIG_GROUP_SOURCE_NUM_SOURCES "num-sources"
#define CONFIG_GROUP_SOURCE_INTRA_DECODE "intra-decode-enable"
#define CONFIG_GROUP_SOURCE_DEC_SKIP_FRAMES "dec-skip-frames"
#define CONFIG_GROUP_SOURCE_NUM_DECODE_SURFACES "num-decode-surfaces"
#define CONFIG_GROUP_SOURCE_NUM_EXTRA_SURFACES "num-extra-surfaces"
#define CONFIG_GROUP_SOURCE_DROP_FRAME_INTERVAL "drop-frame-interval"
#define CONFIG_GROUP_SOURCE_CAMERA_ID "camera-id"
#define CONFIG_GROUP_SOURCE_ID "source-id"
#define CONFIG_GROUP_SOURCE_SELECT_RTP_PROTOCOL "select-rtp-protocol"
#define CONFIG_GROUP_SOURCE_RTSP_RECONNECT_INTERVAL_SEC "rtsp-reconnect-interval-sec"
#define CONFIG_GROUP_SOURCE_RTSP_RECONNECT_ATTEMPTS "rtsp-reconnect-attempts"
#define CONFIG_GROUP_SOURCE_SMART_RECORD_ENABLE "smart-record"
#define CONFIG_GROUP_SOURCE_SMART_RECORD_DIRPATH "smart-rec-dir-path"
#define CONFIG_GROUP_SOURCE_SMART_RECORD_FILE_PREFIX "smart-rec-file-prefix"
#define CONFIG_GROUP_SOURCE_SMART_RECORD_CACHE_SIZE_LEGACY "smart-rec-video-cache"
#define CONFIG_GROUP_SOURCE_SMART_RECORD_CACHE_SIZE "smart-rec-cache"
#define CONFIG_GROUP_SOURCE_SMART_RECORD_CONTAINER "smart-rec-container"
#define CONFIG_GROUP_SOURCE_SMART_RECORD_START_TIME "smart-rec-start-time"
#define CONFIG_GROUP_SOURCE_SMART_RECORD_DEFAULT_DURATION "smart-rec-default-duration"
#define CONFIG_GROUP_SOURCE_SMART_RECORD_DURATION "smart-rec-duration"
#define CONFIG_GROUP_SOURCE_SMART_RECORD_INTERVAL "smart-rec-interval"

/**
 * Function to parse class label file. Parses the labels into a 2D-array of
 * strings. Refer the SDK documentation for format of the labels file.
 *
 * @param[in] config pointer to @ref NvDsGieConfig
 *
 * @return true if file parsed successfully else returns false.
 */
gboolean
parse_labels_file (NvDsGieConfig *config);

/**
 * Function to read properties of source element from configuration file.
 *
 * @param[in] config pointer to @ref NvDsDewarperConfig
 * @param[in] key_file pointer to file having key value pairs.
 * @param[in] group name of property group @ref CONFIG_GROUP_DEWARPER
 * @param[in] cfg_file_path path of configuration file.
 *
 * @return true if parsed successfully.
 */
gboolean
parse_dewarper (NvDsDewarperConfig * config, GKeyFile * key_file, gchar *cfg_file_path, gchar * group);

/**
 * Function to read properties of source element from configuration file.
 *
 * @param[in] config pointer to @ref NvDsSourceConfig
 * @param[in] key_file pointer to file having key value pairs.
 * @param[in] group name of property group @ref CONFIG_GROUP_SOURCE
 * @param[in] cfg_file_path path of configuration file.
 *
 * @return true if parsed successfully.
 */
gboolean
parse_source (NvDsSourceConfig * config, GKeyFile * key_file,
    gchar * group, gchar * cfg_file_path);

/**
 * Function to read properties of NvSegVisual element from configuration file.
 *
 * @param[in] config pointer to @ref NvDsSegVisualConfig
 * @param[in] key_file pointer to file having key value pairs.
 *
 * @return true if parsed successfully.
 */
gboolean parse_segvisual (NvDsSegVisualConfig * config, GKeyFile * key_file);

/**
 * Function to read properties of OSD element from configuration file.
 *
 * @param[in] config pointer to @ref NvDsOSDConfig
 * @param[in] key_file pointer to file having key value pairs.
 *
 * @return true if parsed successfully.
 */
gboolean parse_osd (NvDsOSDConfig * config, GKeyFile * key_file);

/**
 * Function to read properties of nvdspreprocess element from configuration file.
 *
 * @param[in] config pointer to @ref NvDsPreProcessConfig
 * @param[in] key_file pointer to file having key value pairs.
 * @param[in] group name of property group @ref CONFIG_GROUP_PREPROCESS and
 *            @ref CONFIG_GROUP_SECONDARY_PREPROCESS
 * @param[in] cfg_file_path path of configuration file.
 *
 * @return true if parsed successfully.
 */
gboolean
parse_preprocess (NvDsPreProcessConfig * config, GKeyFile * key_file,
    gchar * group, gchar * cfg_file_path);

/**
 * Function to read properties of infer element from configuration file.
 *
 * @param[in] config pointer to @ref NvDsGieConfig
 * @param[in] key_file pointer to file having key value pairs.
 * @param[in] group name of property group @ref CONFIG_GROUP_PRIMARY_GIE and
 *            @ref CONFIG_GROUP_SECONDARY_GIE
 * @param[in] cfg_file_path path of configuration file.
 *
 * @return true if parsed successfully.
 */
gboolean
parse_gie (NvDsGieConfig * config, GKeyFile * key_file, gchar * group,
    gchar * cfg_file_path);

/**
 * Function to read properties of tracker element from configuration file.
 *
 * @param[in] config pointer to @ref NvDsTrackerConfig
 * @param[in] key_file pointer to file having key value pairs.
 * @param[in] cfg_file_path path of configuration file.
 *
 * @return true if parsed successfully.
 */
gboolean
parse_tracker (NvDsTrackerConfig * config, GKeyFile * key_file, gchar * cfg_file_path);

/**
 * Function to read properties of sink element from configuration file.
 *
 * @param[in] config pointer to @ref NvDsSinkSubBinConfig
 * @param[in] key_file pointer to file having key value pairs.
 * @param[in] group name of property group @ref CONFIG_GROUP_SINK
 *
 * @return true if parsed successfully.
 */
gboolean
parse_sink (NvDsSinkSubBinConfig * config, GKeyFile * key_file, gchar * group, gchar * cfg_file_path);

/**
 * Function to read properties of tiler element from configuration file.
 *
 * @param[in] config pointer to @ref NvDsTiledDisplayConfig
 * @param[in] key_file pointer to file having key value pairs.
 *
 * @return true if parsed successfully.
 */
gboolean
parse_tiled_display (NvDsTiledDisplayConfig * config, GKeyFile * key_file);

/**
 * Function to read properties of dsanalytics element from configuration file.
 *
 * @param[in] config pointer to @ref NvDsDsAnalyticsConfig
 * @param[in] key_file pointer to file having key value pairs.
 *
 * @return true if parsed successfully.
 */
gboolean
parse_dsanalytics (NvDsDsAnalyticsConfig * config, GKeyFile * key_file, gchar* cfg_file_path);

/**
 * Function to read properties of dsexample element from configuration file.
 *
 * @param[in] config pointer to @ref NvDsDsExampleConfig
 * @param[in] key_file pointer to file having key value pairs.
 *
 * @return true if parsed successfully.
 */
gboolean
parse_dsexample (NvDsDsExampleConfig * config, GKeyFile * key_file);

/**
 * Function to read properties of streammux element from configuration file.
 *
 * @param[in] config pointer to @ref NvDsStreammuxConfig
 * @param[in] key_file pointer to file having key value pairs.
 * @param[in] cfg_file_path path of configuration file.
 *
 * @return true if parsed successfully.
 */
gboolean
parse_streammux (NvDsStreammuxConfig * config, GKeyFile * key_file, gchar * cfg_file_path);

/**
 * Function to read properties of message converter element from configuration file.
 *
 * @param[in] config pointer to @ref NvDsSinkMsgConvBrokerConfig
 * @param[in] key_file pointer to file having key value pairs.
 * @param[in] group name of property group @ref CONFIG_GROUP_MSG_CONVERTER
 * @param[in] cfg_file_path path of configuration file.
 *
 * @return true if parsed successfully.
 */
gboolean
parse_msgconv (NvDsSinkMsgConvBrokerConfig *config, GKeyFile *key_file, gchar *group, gchar *cfg_file_path);

/**
 * Function to read properties of message consumer element from configuration file.
 *
 * @param[in] config pointer to @ref NvDsMsgConsumerConfig
 * @param[in] key_file pointer to file having key value pairs.
 * @param[in] group name of property group @ref CONFIG_GROUP_MSG_CONSUMER
 * @param[in] cfg_file_path path of configuration file.
 *
 * @return true if parsed successfully.
 */
gboolean
parse_msgconsumer (NvDsMsgConsumerConfig *config, GKeyFile *key_file, gchar *group, gchar *cfg_file_path);

/**
 * Function to read properties of image save from configuration file.
 *
 * @param[in] config pointer to @ref NvDsMsgConsumerConfig
 * @param[in] key_file pointer to file having key value pairs.
 * @param[in] group name of property group @ref CONFIG_GROUP_MSG_CONSUMER
 * @param[in] cfg_file_path path of configuration file.
 *
 * @return true if parsed successfully.
 */
gboolean
parse_image_save (NvDsImageSave *config, GKeyFile *key_file,
                   gchar *group, gchar *cfg_file_path);

/**
 * Utility function to convert relative path in configuration file
 * with absolute path.
 *
 * @param[in] cfg_file_path path of configuration file.
 * @param[in] file_path relative path of file.
 */
gchar *
get_absolute_file_path (gchar *cfg_file_path, gchar * file_path);

#ifdef __cplusplus
}
#endif

#endif