|
NVIDIA DeepStream SDK API Reference
|
6.4 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 {
101 customProcessor = std::move(processor);
102 lib = std::move(customLib);
122 "load custom dataloader failed");
124 loaderSrc.
config = compConfig;
132 constexpr
static size_t kPoolSize = 6;
136 !caps.empty(),
ErrCode::kConfig,
"caps must be configure for dataloader source");
137 CapsPtr srcCaps(gst_caps_from_string(caps.c_str()));
140 G_OBJECT(loaderEle.
get()),
"do-timestamp", TRUE,
"stream-type", GST_APP_STREAM_TYPE_STREAM,
141 "max-bytes", (uint64_t)(kPoolSize *
sizeof(
NvDs3DBuffer)),
"min-percent", 80,
"caps",
142 srcCaps.
get(), NULL);
146 "Dataloader start config: %s failed", compConfig.
filePath.c_str());
149 GstAppSrc* appSrc = GST_APP_SRC(loaderEle.
get());
153 "Set dataloader into GstAppsrc failed.");
165 "load custom datarender failed");
167 renderSink.
config = compConfig;
175 uint32_t maxBuffers = 4;
179 !caps.empty(),
ErrCode::kConfig,
"caps must be configure for datarender source");
180 CapsPtr sinkCaps(gst_caps_from_string(caps.c_str()));
182 GObject* eleObj = G_OBJECT(renderEle.
get());
184 eleObj,
"wait-on-eos", TRUE,
"max-buffers", (uint32_t)maxBuffers,
"caps", sinkCaps.
get(),
187 auto setGstProperties = [eleObj, &compConfig]() {
188 YAML::Node node = YAML::Load(compConfig.
rawContent);
189 auto properties = node[
"gst_properties"];
191 auto sync = properties[
"sync"];
192 auto async = properties[
"async"];
193 auto drop = properties[
"drop"];
195 g_object_set(eleObj,
"sync", sync.as<
bool>(),
nullptr);
198 g_object_set(eleObj,
"async", async.as<
bool>(),
nullptr);
201 g_object_set(eleObj,
"drop", drop.as<
bool>(),
nullptr);
211 "Dataloader start config: %s failed", compConfig.
filePath.c_str());
214 GstAppSink* appSink = GST_APP_SINK(renderEle.
get());
218 "Set datarender into GstAppSink failed.");
225 #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