NVIDIA DeepStream SDK API Reference

9.2 Release
sources/libs/ds3d/databridge/video/video_config.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2023-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_DATABRIDGE_VIDEO_CONFIG_H
19 #define DS3D_DATABRIDGE_VIDEO_CONFIG_H
20 
21 #include <ds3d/common/common.h>
22 #include <ds3d/common/func_utils.h>
23 
24 #include "ds3d/common/hpp/yaml_config.hpp"
25 
26 namespace ds3d { namespace impl { namespace bridge {
27 
28 struct Config {
30  bool surfaceToImage = false;
31  std::string outputImageKey = kColorFrame;
34 };
35 
36 inline ErrCode
37 parseConfig(const std::string& content, const std::string& path, Config& config)
38 {
40  config::parseComponentConfig(content, path, config.compConfig),
41  "parse dataloader component content failed");
42 
43  YAML::Node node = YAML::Load(config.compConfig.configBody);
44  auto ySurf2Img = node["surface_to_image"];
45  auto yImageKey = node["output_image_key"];
46  auto yObj2DKey = node["output_object2d_key"];
47  auto yVideoPreProcKey = node["output_video_preprocess_key"];
48  if (ySurf2Img) {
49  config.surfaceToImage = ySurf2Img.as<bool>();
50  }
51  if (yImageKey) {
52  config.outputImageKey = yImageKey.as<std::string>();
53  }
54  if (yObj2DKey) {
55  config.outputObject2DKey = yObj2DKey.as<std::string>();
56  }
57  if (yVideoPreProcKey) {
58  config.outputVideoPreProcTensorKey = yVideoPreProcKey.as<std::string>();
59  }
60 
61  return ErrCode::kGood;
62 }
63 
64 
65 }}} // namespace ds3d::impl::bridge
66 
67 #endif // DS3D_DATABRIDGE_VIDEO_CONFIG_H
ds3d::impl::bridge::Config
Definition: sources/libs/ds3d/databridge/video/video_config.h:28
ds3d::impl::bridge::Config::compConfig
config::ComponentConfig compConfig
Definition: sources/libs/ds3d/databridge/video/video_config.h:29
ds3d::kVideoPreProcTensor
static constexpr const char * kVideoPreProcTensor
Definition: includes/ds3d/common/common.h:82
ds3d::ErrCode::kGood
@ kGood
ds3d::impl::bridge::Config::outputObject2DKey
std::string outputObject2DKey
Definition: sources/libs/ds3d/databridge/video/video_config.h:32
ds3d::kColorFrame
static constexpr const char * kColorFrame
Definition: includes/ds3d/common/common.h:78
ds3d::config::parseComponentConfig
ErrCode parseComponentConfig(const std::string &yamlComp, const std::string &path, ComponentConfig &config)
Definition: includes/ds3d/common/hpp/yaml_config.hpp:57
ds3d::ErrCode
ErrCode
Definition: includes/ds3d/common/common.h:47
ds3d::impl::bridge::parseConfig
ErrCode parseConfig(const std::string &content, const std::string &path, Config &config)
Definition: sources/libs/ds3d/databridge/video/video_config.h:37
ds3d::impl::bridge::Config::outputImageKey
std::string outputImageKey
Definition: sources/libs/ds3d/databridge/video/video_config.h:31
ds3d::impl::bridge::Config::outputVideoPreProcTensorKey
std::string outputVideoPreProcTensorKey
Definition: sources/libs/ds3d/databridge/video/video_config.h:33
ds3d::kObject2DBboxKey
static constexpr const char * kObject2DBboxKey
get array of Object2DBbox from FrameGuard [N, sizeof(Object2DBbox)]
Definition: includes/ds3d/common/common.h:140
ds3d::config::ComponentConfig::configBody
std::string configBody
Definition: includes/ds3d/common/config.h:48
DS3D_ERROR_RETURN
#define DS3D_ERROR_RETURN(code, fmt,...)
Definition: includes/ds3d/common/defines.h:77
ds3d::impl::bridge::Config::surfaceToImage
bool surfaceToImage
Definition: sources/libs/ds3d/databridge/video/video_config.h:30
ds3d::config::ComponentConfig
Definition: includes/ds3d/common/config.h:38
ds3d
Definition: includes/ds3d/common/abi_dataprocess.h:25