NVIDIA DeepStream SDK API Reference

8.0 Release
ensemble_render.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 
13 #include <iostream>
15 #include <ds3d/common/defines.h>
17 
18 #include "data_receiver.hpp"
19 
20 
21 namespace deepstream {
22 
24 public:
26  using namespace ds3d;
27  ErrCode c;
28  if (!_initialized) {
29  _initialized = true;
30  std::string configPath;
31  Ptr<CustomLibFactory> customlib;
32  std::string configContent;
33  receiver.getProperty("config-path", configPath);
34  std::cout << "ensemble_render plugin config-path: " << configPath << std::endl;
35  readFile(configPath, configContent);
36  config::parseComponentConfig(configContent, configPath, config);
37  c = gst::loadCustomProcessor(config, render, customlib);
38  DS_ASSERT(c == ErrCode::kGood);
39  c = render.start(config.rawContent, config.filePath);
40  DS_ASSERT(c == ErrCode::kGood);
41  }
42  }
43 
44  virtual int consume(DataReceiver& receiver, Buffer buffer) {
45  if (!_initialized) initialize(receiver);
47  ds3d::ErrCode c;
48  const ds3d::abiRefDataMap* datamap = nullptr;
49  GstBuffer* buf = buffer.give();
50  gst_buffer_unref(buf);
51  c = NvDs3D_Find1stDataMap(buf, datamap);
53  DS_ASSERT(datamap);
54  ds3d::GuardDataMap guardData(*datamap);
55  c = render.render(guardData, [](ds3d::ErrCode err, const ds3d::abiRefDataMap*) {});
57  return 1;
58  }
59 
60 private:
61  OpaqueBuffer *buffer_ = nullptr;
62  ds3d::GuardDataRender render;
64  bool _initialized = false;
65 };
66 }
nvds3d_gst_plugin.h
DS_ASSERT
#define DS_ASSERT(...)
Definition: defines.h:31
deepstream::DataReceiver::IDataConsumer
required interface for a data receiver
Definition: data_receiver.hpp:45
ds3d::ErrCode::kGood
@ kGood
ds3d::gst::loadCustomProcessor
ErrCode loadCustomProcessor(const config::ComponentConfig &compConfig, GuardProcess &customProcessor, Ptr< CustomLibFactory > &lib)
Definition: nvds3d_gst_plugin.h:78
ds3d::readFile
bool readFile(const std::string &path, std::string &context)
Definition: func_utils.h:200
ds3d::GuardDataProcess::state
State state() const
Definition: dataprocess.hpp:88
ds3d::abiRefT< abiDataMap >
defines.h
ds3d::config::parseComponentConfig
ErrCode parseComponentConfig(const std::string &yamlComp, const std::string &path, ComponentConfig &config)
Definition: yaml_config.hpp:53
receiver
static deepstream::Cloud2DeviceReceiver receiver
Definition: smart_recording_action.hpp:24
ds3d::ErrCode
ErrCode
Definition: common.h:43
datamap.hpp
NvDs3D_Find1stDataMap
DS3D_EXPORT_API ds3d::ErrCode NvDs3D_Find1stDataMap(GstBuffer *buf, const ds3d::abiRefDataMap *&datamap)
deepstream::EnsembleRender::consume
virtual int consume(DataReceiver &receiver, Buffer buffer)
Definition: ensemble_render.hpp:44
ds3d::GuardDataRender::render
ErrCode render(GuardDataMap datamap, abiOnDataCB::CppFunc dataDoneCB)
Definition: datarender.hpp:69
deepstream
Definition: buffer.hpp:33
deepstream::EnsembleRender
Definition: ensemble_render.hpp:23
OpaqueBuffer
struct _GstBuffer OpaqueBuffer
Definition: buffer.hpp:31
deepstream::Buffer
Base class of a buffer.
Definition: buffer.hpp:46
ds3d::Ptr
ShrdPtr< T > Ptr
Definition: obj.hpp:33
GstBuffer
struct _GstBuffer GstBuffer
Definition: idatatype.h:19
ds3d::config::ComponentConfig
Definition: includes/ds3d/common/config.h:34
ds3d::GuardDataRender
GuardDataRender is the safe access entry for abiDataRender.
Definition: datarender.hpp:53
ds3d::GuardDataMap
Definition: datamap.hpp:21
ds3d::State::kRunning
@ kRunning
deepstream::DataReceiver
A specific signal handler for consuming data.
Definition: data_receiver.hpp:37
ds3d
Definition: abi_dataprocess.h:21
data_receiver.hpp
deepstream::EnsembleRender::initialize
void initialize(DataReceiver &receiver)
Definition: ensemble_render.hpp:25
deepstream::Buffer::give
OpaqueBuffer * give()
Give up the ownership of this buffer and return the opaque buffer pointer.