NVIDIA DeepStream SDK API Reference

8.0 Release
source_config.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 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 
20 #ifndef NVIDIA_DEEPSTREAM_SOURCE_CONFIG
21 #define NVIDIA_DEEPSTREAM_SOURCE_CONFIG
22 
23 #include "object.hpp"
24 #include <vector>
25 #include <string>
26 
27 namespace deepstream {
28 
29 typedef struct {
30  // Props for urisrcbin/multiurisrcbin
31  std::string uri;
32  std::string sensor_id;
33  std::string sensor_name;
34 } SensorInfo;
35 
36 typedef struct
37 {
38  // Prop for camera type: V4L2/CSI
39  std::string camera_type;
40  // Common props for Camera source (V4L2/CSI)
41  std::string camera_video_format = "NV12";
42  std::string camera_width;
43  std::string camera_height;
44  std::string camera_fps_n;
45  std::string camera_fps_d;
46  // Props only for CSI source
47  int camera_csi_sensor_id = -1;
48  // Props only for V4L2 source
49  std::string camera_v4l2_dev_node;
50  // Extra Props (need to check)
51  int gpu_id = 0;
52  int nvbuf_mem_type = 0;
53  int nvvideoconvert_copy_hw = 0;
54 } CameraInfo;
55 
56 class SourceConfig {
57  public:
61  SourceConfig(const std::string& config_file);
62 
66  uint32_t nSources() const;
67 
71  uint32_t nCameraSources() const;
72 
76  std::string listSensorIds() const;
77 
81  std::string listSensorNames() const;
82 
86  std::string listUris() const;
87 
91  SensorInfo getSensorInfo(uint32_t index) const;
92 
96  CameraInfo getCameraInfo(uint32_t index) const;
97 
101  const YAML::Node& getProperties() const;
102 
106  bool useMultiUriSrcBin() const;
107 
111  bool useUriSrcBin() const;
112 
116  bool useCameraBin() const;
117 
118 protected:
119  std::vector<SensorInfo> sensor_info_;
120  std::vector<CameraInfo> camera_info_;
121  YAML::Node properties_;
122  bool use_nvmultiurisrcbin_ = false;
123  bool use_nvurisrcbin_ = false;
124  bool use_camerabin_ = false;
125 };
126 }
127 
128 #endif
deepstream::SensorInfo::uri
std::string uri
Definition: source_config.hpp:31
deepstream::SourceConfig::getSensorInfo
SensorInfo getSensorInfo(uint32_t index) const
Get sensor information for a specific source.
deepstream::CameraInfo::camera_height
std::string camera_height
Definition: source_config.hpp:43
deepstream::SourceConfig::camera_info_
std::vector< CameraInfo > camera_info_
Definition: source_config.hpp:120
deepstream::SourceConfig::getCameraInfo
CameraInfo getCameraInfo(uint32_t index) const
Get information for a specific camera source.
deepstream::SourceConfig::SourceConfig
SourceConfig(const std::string &config_file)
Create a source config from a yaml config file.
deepstream::SourceConfig::use_nvmultiurisrcbin_
bool use_nvmultiurisrcbin_
Definition: source_config.hpp:122
deepstream::SourceConfig::getProperties
const YAML::Node & getProperties() const
Get properties for setting the source bin(s)
deepstream::SourceConfig::useCameraBin
bool useCameraBin() const
If using the nvv4l2srcbin.
deepstream::SourceConfig::listSensorNames
std::string listSensorNames() const
List sensor names in a string, separated by ';'.
deepstream::CameraInfo::camera_width
std::string camera_width
Definition: source_config.hpp:42
deepstream::CameraInfo::camera_type
std::string camera_type
Definition: source_config.hpp:39
deepstream::CameraInfo::camera_fps_d
std::string camera_fps_d
Definition: source_config.hpp:45
deepstream
Definition: buffer.hpp:33
deepstream::SourceConfig::use_camerabin_
bool use_camerabin_
Definition: source_config.hpp:124
deepstream::SourceConfig::nSources
uint32_t nSources() const
Get the number of the sources.
deepstream::CameraInfo::camera_fps_n
std::string camera_fps_n
Definition: source_config.hpp:44
deepstream::SourceConfig::listSensorIds
std::string listSensorIds() const
List sensor ids in a string, separated by ';'.
deepstream::SourceConfig::properties_
YAML::Node properties_
Definition: source_config.hpp:121
deepstream::SourceConfig::useUriSrcBin
bool useUriSrcBin() const
If using the nvurisrcbin.
deepstream::SensorInfo::sensor_name
std::string sensor_name
Definition: source_config.hpp:33
deepstream::CameraInfo::camera_v4l2_dev_node
std::string camera_v4l2_dev_node
Definition: source_config.hpp:49
deepstream::SensorInfo::sensor_id
std::string sensor_id
Definition: source_config.hpp:32
deepstream::SourceConfig::useMultiUriSrcBin
bool useMultiUriSrcBin() const
If using the nvmultiurisrcbin.
deepstream::SensorInfo
Definition: source_config.hpp:29
deepstream::SourceConfig::sensor_info_
std::vector< SensorInfo > sensor_info_
Definition: source_config.hpp:119
deepstream::SourceConfig::listUris
std::string listUris() const
List sensor uris in a string, separated by ';'.
deepstream::SourceConfig
Definition: source_config.hpp:56
object.hpp
deepstream::CameraInfo
Definition: source_config.hpp:36
deepstream::SourceConfig::nCameraSources
uint32_t nCameraSources() const
Get the number of the camera sources.
deepstream::SourceConfig::use_nvurisrcbin_
bool use_nvurisrcbin_
Definition: source_config.hpp:123