NVIDIA DeepStream SDK API Reference

9.1 Release
sources/includes/ds3d/common/config.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-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 DS3D_COMMON_HPP_CONFIG_HPP
19 #define DS3D_COMMON_HPP_CONFIG_HPP
20 
21 #include <ds3d/common/common.h>
22 #include <ds3d/common/idatatype.h>
23 #include <ds3d/common/type_trait.h>
24 
25 namespace ds3d { namespace config {
26 
27 enum class ComponentType : int {
28  kNone = 0,
29  kDataLoader = 1,
30  kDataFilter = 2,
31  kDataRender = 3,
32  kUserApp = 4,
33  kDataBridge = 5,
34  kDataMixer = 6,
35  kGstParseBin = 10,
36 };
37 
39  std::string name;
41  std::string gstInCaps;
42  std::string gstOutCaps;
43  std::string linkTo;
44  std::string linkFrom;
45  std::string withQueue; // choose from [src, sink]
46  std::string customLibPath;
47  std::string customCreateFunction;
48  std::string configBody;
49 
50  // raw data
51  std::string rawContent;
52  std::string filePath;
53 };
54 
55 inline ComponentType
56 componentType(const std::string& strType)
57 {
58  const static std::unordered_map<std::string, ComponentType> kTypeMap = {
59  {"ds3d::dataloader", ComponentType::kDataLoader},
60  {"ds3d::datafilter", ComponentType::kDataFilter},
61  {"ds3d::datarender", ComponentType::kDataRender},
62  {"ds3d::databridge", ComponentType::kDataBridge},
63  {"ds3d::datamixer", ComponentType::kDataMixer},
64  {"ds3d::userapp", ComponentType::kUserApp},
65  {"ds3d::gstparsebin", ComponentType::kGstParseBin},
66  };
67  DS_ASSERT(!strType.empty());
68  auto tpIt = kTypeMap.find(strType);
70  tpIt != kTypeMap.end(), ComponentType::kNone, "component type: %s is not supportted.",
71  strType.c_str());
72  return tpIt->second;
73 }
74 
75 inline const char*
77 {
78  switch(type) {
79  case ComponentType::kDataLoader: return "ds3d::dataloader";
80  case ComponentType::kDataFilter: return "ds3d::datafilter";
81  case ComponentType::kDataRender: return "ds3d::datarender";
82  case ComponentType::kDataBridge: return "ds3d::databridge";
83  case ComponentType::kDataMixer: return "ds3d::datamixer";
85  return "ds3d::userapp";
87  return "ds3d::gstparsebin";
88  default: return "ds3d::unknown::component";
89  }
90 }
91 
92 }} // namespace ds3d::config
93 
94 #endif // DS3D_COMMON_HPP_CONFIG_HPP
ds3d::config::ComponentType
ComponentType
Definition: sources/includes/ds3d/common/config.h:27
ds3d::config::ComponentConfig::type
ComponentType type
Definition: sources/includes/ds3d/common/config.h:40
ds3d::config::ComponentType::kNone
@ kNone
DS3D_FAILED_RETURN
#define DS3D_FAILED_RETURN(condition, ret, fmt,...)
Definition: sources/includes/ds3d/common/defines.h:69
ds3d::config::ComponentType::kDataFilter
@ kDataFilter
ds3d::config::ComponentConfig::gstInCaps
std::string gstInCaps
Definition: sources/includes/ds3d/common/config.h:41
ds3d::config::ComponentType::kDataBridge
@ kDataBridge
DS_ASSERT
#define DS_ASSERT(...)
Definition: sources/includes/ds3d/common/defines.h:36
ds3d::config::ComponentConfig::withQueue
std::string withQueue
Definition: sources/includes/ds3d/common/config.h:45
ds3d::config::ComponentType::kGstParseBin
@ kGstParseBin
ds3d::config::ComponentConfig::linkFrom
std::string linkFrom
Definition: sources/includes/ds3d/common/config.h:44
ds3d::config::ComponentType::kDataRender
@ kDataRender
ds3d::config::componentTypeStr
const char * componentTypeStr(ComponentType type)
Definition: sources/includes/ds3d/common/config.h:76
ds3d::config::ComponentConfig::configBody
std::string configBody
Definition: sources/includes/ds3d/common/config.h:48
ds3d::config::ComponentType::kDataLoader
@ kDataLoader
ds3d::config::ComponentConfig::filePath
std::string filePath
Definition: sources/includes/ds3d/common/config.h:52
ds3d::config::ComponentConfig::customCreateFunction
std::string customCreateFunction
Definition: sources/includes/ds3d/common/config.h:47
ds3d::config::ComponentConfig::name
std::string name
Definition: sources/includes/ds3d/common/config.h:39
ds3d::config::ComponentConfig::rawContent
std::string rawContent
Definition: sources/includes/ds3d/common/config.h:51
ds3d::config::ComponentConfig
Definition: sources/includes/ds3d/common/config.h:38
ds3d::config::ComponentConfig::gstOutCaps
std::string gstOutCaps
Definition: sources/includes/ds3d/common/config.h:42
ds3d::config::componentType
ComponentType componentType(const std::string &strType)
Definition: sources/includes/ds3d/common/config.h:56
ds3d
Definition: sources/includes/ds3d/common/abi_dataprocess.h:25
ds3d::config::ComponentType::kDataMixer
@ kDataMixer
ds3d::config::ComponentConfig::linkTo
std::string linkTo
Definition: sources/includes/ds3d/common/config.h:43
ds3d::config::ComponentConfig::customLibPath
std::string customLibPath
Definition: sources/includes/ds3d/common/config.h:46
ds3d::config::ComponentType::kUserApp
@ kUserApp