NVIDIA DeepStream SDK API Reference

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