NVIDIA DeepStream SDK API Reference

8.0 Release
deepstream_3d_sensor_fusion.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
13 #ifndef DEEPSTREAM_DS3D_SENSOR_FUSION_HPP
14 #define DEEPSTREAM_DS3D_SENSOR_FUSION_HPP
15 
16 #include <unistd.h>
17 
18 // inlcude all ds3d hpp header files
24 
25 // inlucde nvds3d Gst header files
28 #include <ds3d/gst/nvds3d_meta.h>
30 
31 #include "gstnvdsmeta.h"
32 
33 using namespace ds3d;
34 
35 #undef CHECK_ERROR
36 #define CHECK_ERROR(statement, fmt, ...) DS3D_FAILED_RETURN(statement, -1, fmt, ##__VA_ARGS__)
37 
38 #undef RETURN_ERROR
39 #define RETURN_ERROR(statement, fmt, ...) DS3D_ERROR_RETURN(statement, fmt, ##__VA_ARGS__)
40 
41 using ConfigList = std::vector<config::ComponentConfig>;
42 
43 struct Component {
44 public:
45  virtual ~Component() = default;
46  bool isGstPlugin() const;
47  config::ComponentType type() const { return config.type; }
48 
51 };
52 
53 struct AppProfiler {
54 public:
56  bool enableDebug = false;
57  bool eosAutoStop = true;
58  bool probeBuffer = false;
59 
60  AppProfiler() = default;
61  AppProfiler(const AppProfiler&) = delete;
62  void operator=(const AppProfiler&) = delete;
64 
66  {
68  this->config = compConf;
69  YAML::Node node = YAML::Load(compConf.rawContent);
70  auto debugNode = node["enable_debug"];
71  auto eosNode = node["eos_auto_stop"];
72  auto probeNode = node["probe_buffer"];
73  if (debugNode) {
74  enableDebug = debugNode.as<bool>();
75  }
76 
77  if (eosNode) {
78  eosAutoStop = eosNode.as<bool>();
79  }
80  if (probeNode) {
81  probeBuffer = probeNode.as<bool>();
82  }
83  return ErrCode::kGood;
84  }
85 };
86 
88 public:
89  SensorFusionApp() = default;
91  {
92  stop();
93  deinit();
94  }
95 
96  ErrCode setup(const std::string& configPath, std::function<void()> windowClosed);
97  ErrCode stop() override;
98  void deinit() override;
99 
100  AppProfiler& profiler() { return _appProfiler; }
101 
102 private:
103  ErrCode init(const std::string& name) override;
104  ErrCode buildComponents(const ConfigList& componentConfigs);
105  ErrCode LinkComponents();
106 
107  std::unique_ptr<Component> createLoader(const config::ComponentConfig& c);
108  std::unique_ptr<Component> createRender(const config::ComponentConfig& c);
109  std::unique_ptr<Component> createFilterBridge(const config::ComponentConfig& c);
110  std::unique_ptr<Component> createMixer(const config::ComponentConfig& c);
111  std::unique_ptr<Component> createGstParseBin(const config::ComponentConfig& c);
112  ErrCode setupProfiling();
113 
114 private:
115  std::string _configPath;
116  std::map<std::string, Ptr<Component>> _components;
117  std::function<void()> _windowClosedCb;
118  AppProfiler _appProfiler;
119 };
120 
121 #endif
ds3d::config::ComponentType
ComponentType
Definition: includes/ds3d/common/config.h:23
yaml_config.hpp
nvds3d_gst_plugin.h
AppProfiler::parse
ErrCode parse(const config::ComponentConfig &compConf)
Definition: deepstream_3d_sensor_fusion.hpp:65
ds3d::config::ComponentConfig::type
ComponentType type
Definition: includes/ds3d/common/config.h:36
DS_ASSERT
#define DS_ASSERT(...)
Definition: defines.h:31
SensorFusionApp::profiler
AppProfiler & profiler()
Definition: deepstream_3d_sensor_fusion.hpp:100
AppProfiler
Definition: deepstream_3d_sensor_fusion.hpp:53
ds3d::ErrCode::kGood
@ kGood
dataloader.hpp
ds3d::gst::ElePtr
Definition: nvds3d_gst_ptr.h:150
ds3d::ErrCode
ErrCode
Definition: common.h:43
nvds3d_gst_ptr.h
datamap.hpp
frame.hpp
SensorFusionApp
Definition: deepstream_3d_sensor_fusion.hpp:87
Component::config
config::ComponentConfig config
Definition: deepstream_3d_sensor_fusion.hpp:49
gstnvdsmeta.h
nvds3d_pipeline_context.h
AppProfiler::~AppProfiler
~AppProfiler()
Definition: deepstream_3d_sensor_fusion.hpp:63
ds3d::gst::PipelineContext
Definition: nvds3d_pipeline_context.h:62
nvds3d_meta.h
SensorFusionApp::~SensorFusionApp
~SensorFusionApp()
Definition: deepstream_3d_sensor_fusion.hpp:90
AppProfiler::config
config::ComponentConfig config
Definition: deepstream_3d_sensor_fusion.hpp:55
Component::type
config::ComponentType type() const
Definition: deepstream_3d_sensor_fusion.hpp:47
ds3d::config::ComponentConfig::rawContent
std::string rawContent
Definition: includes/ds3d/common/config.h:47
profiling.hpp
ds3d::config::ComponentConfig
Definition: includes/ds3d/common/config.h:34
Component::gstElement
gst::ElePtr gstElement
Definition: deepstream_3d_sensor_fusion.hpp:50
ConfigList
std::vector< config::ComponentConfig > ConfigList
Definition: deepstream_3d_sensor_fusion.hpp:41
ds3d
Definition: abi_dataprocess.h:21
Component
Definition: deepstream_3d_sensor_fusion.hpp:43
ds3d::config::ComponentType::kUserApp
@ kUserApp