NVIDIA DeepStream SDK API Reference

8.0 Release
plugin.h
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 
18 #ifndef _DEEPSTREAM_PLUGIN_H_
19 #define _DEEPSTREAM_PLUGIN_H_
20 
31 #define DS_CUSTOM_PLUGIN_DEFINE(name, description, version, license) \
32  extern "C" void *ds_stub_define_custom_plugin(const char *, const char *, const char *, const char *); \
33  extern "C" void *gst_plugin_##name##_get_desc(void); \
34  extern "C" void *gst_plugin_##name##_get_desc(void) \
35  { \
36  return ds_stub_define_custom_plugin(#name, description, version, license); \
37  }
38 
48 #define DS_CUSTOM_FACTORY_DEFINE_PARAMS_BEGIN(param_spec) static const char* param_spec = "["
49 #define DS_CUSTOM_FACTORY_DEFINE_PARAM(name, type, brief, description, default_value) \
50 "{name: "#name", type: "#type", brief: "#brief", description: "#description", default_value: "#default_value"},"
51 #define DS_CUSTOM_FACTORY_DEFINE_PARAMS_END "]";
52 
67 #define DS_CUSTOM_FACTORY_DEFINE_FULL(factory_name, long_name, klass, description, author, signals, param_spec, \
68  object_class, ...) \
69 class object_class##Factory : public deepstream::CustomFactory { \
70 public: \
71  object_class##Factory() : \
72  CustomFactory(factory_name, gst_custom_factory_get_type(factory_name)) {} \
73  deepstream::CustomObject* createObject(const std::string& name) { \
74  return new object_class(name, factory_name, __VA_ARGS__); \
75  } \
76 }; \
77 extern "C" const FactoryMetadata get_custom_factory_info(void); \
78 extern "C" const FactoryMetadata get_custom_factory_info(void) { \
79  return {factory_name, long_name, klass, description, author, object_class::type(), signals}; \
80 } \
81 extern "C" const char* get_custom_factory_product_param_spec(); \
82 extern "C" const char* get_custom_factory_product_param_spec() { return param_spec; } \
83 extern "C" void register_component_factory(const char *name); \
84 extern "C" void register_component_factory(const char* name) { \
85  deepstream::CommonFactory& factory = \
86  deepstream::CommonFactory::getInstance(); \
87  factory.addCustomFactory(new object_class##Factory(), name); \
88 }
89 
91 #define DS_CUSTOM_FACTORY_DEFINE_WITH_PARAMS(factory_name, long_name, klass, description, author, signals, param_spec, \
92  object_class, implementation) \
93  DS_CUSTOM_FACTORY_DEFINE_FULL(factory_name, long_name, klass, description, author, signals, param_spec, object_class, new implementation)
94 
96 #define DS_CUSTOM_FACTORY_DEFINE_WITH_SIGNALS(factory_name, long_name, klass, description, author, signals, \
97  object_class, implementation) \
98  static const char* param_spec = ""; \
99  DS_CUSTOM_FACTORY_DEFINE_FULL(factory_name, long_name, klass, description, author, signals, param_spec, object_class, new implementation)
100 
102 #define DS_CUSTOM_FACTORY_DEFINE(factory_name, long_name, klass, description, author, \
103  object_class, implementation) \
104  static const char* param_spec = ""; \
105  DS_CUSTOM_FACTORY_DEFINE_FULL(factory_name, long_name, klass, description, author, "", param_spec, object_class, new implementation)
106 
107 #endif