|
NVIDIA DeepStream SDK API Reference
|
7.1 Release
|
Go to the documentation of this file.
14 #ifndef NVDS3D_GST_GST_PLUGINS_H
15 #define NVDS3D_GST_GST_PLUGINS_H
19 #include <gst/app/gstappsink.h>
20 #include <gst/app/gstappsrc.h>
54 namespace ds3d {
namespace gst {
56 template<
class GuardProcess>
76 template <
class GuardProcess>
82 using abiRefType =
typename GuardProcess::abiRefType;
85 GuardProcess processor;
86 processor.reset(customLib->CreateCtx<abiRefType>(
94 uData->customlib = customLib.get();
96 uData->configPath = compConfig.
filePath;
97 processor.setUserData(uData.get(), [holder = customLib, uData = uData](
void*)
mutable {
99 if (holder && holder.use_count() == 1) {
100 holder->keepOpen(true);
104 customProcessor = std::move(processor);
105 lib = std::move(customLib);
125 "load custom dataloader failed");
127 loaderSrc.
config = compConfig;
135 constexpr
static size_t kPoolSize = 6;
139 !caps.empty(),
ErrCode::kConfig,
"caps must be configure for dataloader source");
140 CapsPtr srcCaps(gst_caps_from_string(caps.c_str()));
143 G_OBJECT(loaderEle.
get()),
"do-timestamp", TRUE,
"stream-type", GST_APP_STREAM_TYPE_STREAM,
144 "max-bytes", (uint64_t)(kPoolSize *
sizeof(
NvDs3DBuffer)),
"min-percent", 80,
"caps",
145 srcCaps.
get(), NULL);
149 "Dataloader start config: %s failed", compConfig.
filePath.c_str());
152 GstAppSrc* appSrc = GST_APP_SRC(loaderEle.
get());
156 "Set dataloader into GstAppsrc failed.");
168 "load custom datarender failed");
170 renderSink.
config = compConfig;
178 uint32_t maxBuffers = 4;
182 !caps.empty(),
ErrCode::kConfig,
"caps must be configure for datarender source");
183 CapsPtr sinkCaps(gst_caps_from_string(caps.c_str()));
185 GObject* eleObj = G_OBJECT(renderEle.
get());
187 eleObj,
"wait-on-eos", TRUE,
"max-buffers", (uint32_t)maxBuffers,
"caps", sinkCaps.
get(),
190 auto setGstProperties = [eleObj, &compConfig]() {
191 YAML::Node node = YAML::Load(compConfig.
rawContent);
192 auto properties = node[
"gst_properties"];
194 auto sync = properties[
"sync"];
195 auto async = properties[
"async"];
196 auto drop = properties[
"drop"];
198 g_object_set(eleObj,
"sync", sync.as<
bool>(),
nullptr);
201 g_object_set(eleObj,
"async", async.as<
bool>(),
nullptr);
204 g_object_set(eleObj,
"drop", drop.as<
bool>(),
nullptr);
214 "Dataloader start config: %s failed", compConfig.
filePath.c_str());
217 GstAppSink* appSink = GST_APP_SINK(renderEle.
get());
221 "Set datarender into GstAppSink failed.");
228 #endif // NVDS3D_GST_GST_PLUGINS_H
DS3D_EXTERN_C_BEGIN DS3D_EXPORT_API ds3d::ErrCode NvDs3D_GstAppSrcSetDataloader(GstAppSrc *src, ds3d::abiRefDataLoader *refLoader)
ElePtr elementMake(const std::string &factoryName, const std::string &name="")
const char * componentTypeStr(ComponentType type)
config::ComponentConfig config
DataProcessInfo()=default
std::string getInputCaps()
#define DS3D_EXTERN_C_BEGIN
ErrCode NvDs3D_CreateDataRenderSink(const config::ComponentConfig &compConfig, DataRenderSink &renderSink, bool start)
ErrCode loadCustomProcessor(const config::ComponentConfig &compConfig, GuardProcess &customProcessor, Ptr< CustomLibFactory > &lib)
GuardDataLoader is the safe access entry for abiDataLoader.
DS3D_EXPORT_API ds3d::ErrCode NvDs3D_GstAppSinkSetDataRender(GstAppSink *sink, ds3d::abiRefDataRender *refRender)
constexpr uint32_t kDataProcessUserDataMagic
#define DS3D_EXTERN_C_END
#define DS3D_ERROR_RETURN(code, fmt,...)
ErrCode CatchYamlCall(std::function< ErrCode()> f)
std::string customCreateFunction
ErrCode NvDs3D_CreateDataLoaderSrc(const config::ComponentConfig &compConfig, DataLoaderSrc &loaderSrc, bool start)
Generate DataLoaderSrc from config file.
CustomLibFactory * customlib
GuardDataRender is the safe access entry for abiDataRender.
ErrCode start(const std::string &content, const std::string &path="")
#define DS3D_FAILED_RETURN(condition, ret, fmt,...)
Ptr< CustomLibFactory > customlib
std::string configContent
void reset(GstObjT *obj=nullptr, bool takeOwner=true)
std::string getOutputCaps()
GuardProcess customProcessor
std::string customLibPath