NVIDIA DeepStream SDK API Reference

6.4 Release
MuxConfigParser.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-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_NVSTREAMMUX_PROPERTY_PARSER_H__
25 #define __GST_NVSTREAMMUX_PROPERTY_PARSER_H__
26 
27 #include <glib.h>
28 #include <unordered_map>
29 #include "nvstreammux_batch.h"
30 #include <yaml-cpp/yaml.h>
31 
36 static guint constexpr NVSTREAMMUX_DEFAULT_PROP_GROUP_BATCH_SIZE = 1;
37 static gboolean constexpr NVSTREAMMUX_DEFAULT_PROP_GROUP_ADAPTIVE_BATCHING = TRUE;
38 static gboolean constexpr NVSTREAMMUX_DEFAULT_PROP_GROUP_ENABLE_SOURCE_CONTROL = FALSE;
39 static gboolean constexpr NVSTREAMMUX_DEFAULT_PROP_GROUP_MAX_FPS_CONTROL = FALSE;
45 
47 static guint constexpr NVSTREAMMUX_DEFAULT_SOURCE_GROUP_MAX_FPS_N = 60;
48 static guint constexpr NVSTREAMMUX_DEFAULT_SOURCE_GROUP_MAX_FPS_D = 1;
49 static guint constexpr NVSTREAMMUX_DEFAULT_SOURCE_GROUP_MIN_FPS_N = 30;
50 static guint constexpr NVSTREAMMUX_DEFAULT_SOURCE_GROUP_MIN_FPS_D = 1;
51 static guint constexpr NVSTREAMMUX_DEFAULT_SOURCE_GROUP_PRIORITY = 0;
53 
64 {
65  public:
66 
69 
70  bool SetConfigFile(gchar const * const cfgFilePath);
71 
82  bool ParseConfigs(BatchPolicyConfig* batchPolicy, bool defaults=false, guint numSources=1);
83 
84  private:
85 
86  void ParseTxtConfigCommonProps(BatchPolicyConfig* batchPolicy, gchar* group, GKeyFile* keyFile);
87 
88  bool ParseTxtConfigPerSourceProps(NvStreammuxSourceProps* sourceProps, gchar* group, GKeyFile* keyFile);
89 
90  bool ParseTxtConfig(BatchPolicyConfig* batchPolicy);
91 
92  void ParseYmlConfigCommonProps(BatchPolicyConfig* batchPolicy, std::string group);
93 
94  bool ParseYmlConfigPerSourceProps(NvStreammuxSourceProps* sourceProps, std::string group);
95 
96  bool ParseYmlConfig(BatchPolicyConfig* batchPolicy);
97 
98  gchar* cfgFile;
99 };
100 
101 #endif /*__GST_NVSTREAMMUX_PROPERTY_PARSER_H__*/
NVSTREAMMUX_DEFAULT_PROP_GROUP_ENABLE_SOURCE_CONTROL
static constexpr gboolean NVSTREAMMUX_DEFAULT_PROP_GROUP_ENABLE_SOURCE_CONTROL
Definition: MuxConfigParser.h:38
NVSTREAMMUX_DEFAULT_SOURCE_GROUP_MAX_FRAMES_PER_BATCH
static constexpr guint NVSTREAMMUX_DEFAULT_SOURCE_GROUP_MAX_FRAMES_PER_BATCH
Definition: MuxConfigParser.h:52
NVSTREAMMUX_DEFAULT_PROP_GROUP_OVERALL_MIN_FPS_N
static constexpr guint NVSTREAMMUX_DEFAULT_PROP_GROUP_OVERALL_MIN_FPS_N
Definition: MuxConfigParser.h:42
NVSTREAMMUX_DEFAULT_SOURCE_GROUP_MIN_FPS_D
static constexpr guint NVSTREAMMUX_DEFAULT_SOURCE_GROUP_MIN_FPS_D
Definition: MuxConfigParser.h:50
NVSTREAMMUX_DEFAULT_PROP_GROUP_BATCH_SIZE
static constexpr guint NVSTREAMMUX_DEFAULT_PROP_GROUP_BATCH_SIZE
Definition: MuxConfigParser.h:36
MuxConfigParser
Definition: MuxConfigParser.h:63
NvStreammuxBatchMethod
NvStreammuxBatchMethod
Definition: nvstreammux_batch.h:60
NVSTREAMMUX_DEFAULT_PROP_GROUP_MAX_FPS_CONTROL
static constexpr gboolean NVSTREAMMUX_DEFAULT_PROP_GROUP_MAX_FPS_CONTROL
Definition: MuxConfigParser.h:39
NVSTREAMMUX_DEFAULT_SOURCE_GROUP_MAX_FPS_N
static constexpr guint NVSTREAMMUX_DEFAULT_SOURCE_GROUP_MAX_FPS_N
Defaults for SOURCE_GROUP.
Definition: MuxConfigParser.h:47
MuxConfigParser::MuxConfigParser
MuxConfigParser()
MuxConfigParser::~MuxConfigParser
~MuxConfigParser()
NVSTREAMMUX_DEFAULT_SOURCE_GROUP_PRIORITY
static constexpr guint NVSTREAMMUX_DEFAULT_SOURCE_GROUP_PRIORITY
Definition: MuxConfigParser.h:51
NvStreammuxSourceProps
Definition: nvstreammux_batch.h:50
NVSTREAMMUX_DEFAULT_SOURCE_GROUP_MAX_FPS_D
static constexpr guint NVSTREAMMUX_DEFAULT_SOURCE_GROUP_MAX_FPS_D
Definition: MuxConfigParser.h:48
MuxConfigParser::ParseConfigs
bool ParseConfigs(BatchPolicyConfig *batchPolicy, bool defaults=false, guint numSources=1)
Parse the Config file for per-source properties Note: For batch-size, if config unavailable in the fi...
NVSTREAMMUX_DEFAULT_PROP_GROUP_OVERALL_MAX_SAME_SOURCE_FRAMES
static constexpr guint NVSTREAMMUX_DEFAULT_PROP_GROUP_OVERALL_MAX_SAME_SOURCE_FRAMES
Definition: MuxConfigParser.h:44
NVSTREAMMUX_DEFAULT_PROP_GROUP_ADAPTIVE_BATCHING
static constexpr gboolean NVSTREAMMUX_DEFAULT_PROP_GROUP_ADAPTIVE_BATCHING
Definition: MuxConfigParser.h:37
BATCH_METHOD_ROUND_ROBIN
@ BATCH_METHOD_ROUND_ROBIN
Definition: nvstreammux_batch.h:63
nvstreammux_batch.h
NVSTREAMMUX_DEFAULT_PROP_GROUP_BATCH_METHOD_ALGO_TYPE
static constexpr NvStreammuxBatchMethod NVSTREAMMUX_DEFAULT_PROP_GROUP_BATCH_METHOD_ALGO_TYPE
Defaults for PROP_GROUP.
Definition: MuxConfigParser.h:35
BatchPolicyConfig
Definition: nvstreammux_batch.h:67
NVSTREAMMUX_DEFAULT_PROP_GROUP_OVERALL_MAX_FPS_N
static constexpr guint NVSTREAMMUX_DEFAULT_PROP_GROUP_OVERALL_MAX_FPS_N
Definition: MuxConfigParser.h:40
NVSTREAMMUX_DEFAULT_PROP_GROUP_OVERALL_MAX_FPS_D
static constexpr guint NVSTREAMMUX_DEFAULT_PROP_GROUP_OVERALL_MAX_FPS_D
Definition: MuxConfigParser.h:41
NVSTREAMMUX_DEFAULT_SOURCE_GROUP_MIN_FPS_N
static constexpr guint NVSTREAMMUX_DEFAULT_SOURCE_GROUP_MIN_FPS_N
Definition: MuxConfigParser.h:49
MuxConfigParser::SetConfigFile
bool SetConfigFile(gchar const *const cfgFilePath)
NVSTREAMMUX_DEFAULT_PROP_GROUP_OVERALL_MIN_FPS_D
static constexpr guint NVSTREAMMUX_DEFAULT_PROP_GROUP_OVERALL_MIN_FPS_D
Definition: MuxConfigParser.h:43