NVIDIA DeepStream SDK API Reference

9.2 Release
9.2/sources/gst-plugins/gst-nvdsvideotemplate/includes/nvdscustomlib_interface.hpp
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 __NVDSCUSTOMLIB_INTERFACE_HPP__
19 #define __NVDSCUSTOMLIB_INTERFACE_HPP__
20 
21 #include <string>
22 #include <gst/gstbuffer.h>
23 #include <cuda_runtime.h>
24 
25 enum class BufferResult {
26  Buffer_Ok, // Push the buffer from submit_input function
27  Buffer_Drop, // Drop the buffer inside submit_input function
28  Buffer_Async, // Return from submit_input function, custom lib to push the buffer
29  Buffer_Error // Error occured
30 };
31 
32 struct DSCustom_CreateParams {
33  GstBaseTransform *m_element;
34  GstCaps *m_inCaps;
35  GstCaps *m_outCaps;
36  guint m_gpuId;
38  gboolean m_dummyMetaInsert;
39  gboolean m_fillDummyBatchMeta;
40 };
41 
42 struct Property
43 {
44  Property(std::string arg_key, std::string arg_value) : key(arg_key), value(arg_value)
45  {
46  }
47 
48  std::string key;
49  std::string value;
50 };
51 
52 class IDSCustomLibrary
53 {
54 public:
55  virtual bool SetInitParams (DSCustom_CreateParams *params) = 0;
56  virtual bool SetProperty (Property &prop) = 0;
57  virtual bool HandleEvent (GstEvent *event) = 0;
58  // Returned string ownership is transferred to nvdsvideotemplate.
59  // Implementations must allocate it with new[].
60  // The plugin frees it with delete[].
61  virtual char* QueryProperties () = 0;
62  virtual GstCaps* GetCompatibleCaps (GstPadDirection direction, GstCaps* in_caps, GstCaps* othercaps) = 0;
63  virtual BufferResult ProcessBuffer (GstBuffer *inbuf) = 0;
64  virtual ~IDSCustomLibrary() {};
65 };
66 
67 #endif
DSCustom_CreateParams
Definition: sources/gst-plugins/gst-nvdsvideotemplate/includes/nvdscustomlib_interface.hpp:32
Property::key
std::string key
Definition: sources/gst-plugins/gst-nvdspostprocess/includes/nvdspostprocesslib_interface.hpp:44
IDSCustomLibrary::SetInitParams
virtual bool SetInitParams(DSCustom_CreateParams *params)=0
DSCustom_CreateParams::m_cudaStream
cudaStream_t m_cudaStream
Definition: sources/gst-plugins/gst-nvdsvideotemplate/includes/nvdscustomlib_interface.hpp:37
Property::value
std::string value
Definition: sources/gst-plugins/gst-nvdspostprocess/includes/nvdspostprocesslib_interface.hpp:45
BufferResult::Buffer_Ok
@ Buffer_Ok
cudaStream_t
struct CUstream_st * cudaStream_t
Forward declaration of cudaStream_t.
Definition: includes/nvbufsurftransform.h:40
DSCustom_CreateParams::m_element
GstBaseTransform * m_element
Definition: sources/gst-plugins/gst-nvdsvideotemplate/includes/nvdscustomlib_interface.hpp:33
IDSCustomLibrary
Definition: sources/gst-plugins/gst-nvdsvideotemplate/includes/nvdscustomlib_interface.hpp:52
IDSCustomLibrary::SetProperty
virtual bool SetProperty(Property &prop)=0
GstBuffer
struct _GstBuffer GstBuffer
Definition: includes/ds3d/common/idatatype.h:24
DSCustom_CreateParams::m_inCaps
GstCaps * m_inCaps
Definition: sources/gst-plugins/gst-nvdsvideotemplate/includes/nvdscustomlib_interface.hpp:34
Property
Definition: sources/gst-plugins/gst-nvdspostprocess/includes/nvdspostprocesslib_interface.hpp:38
DSCustom_CreateParams::m_outCaps
GstCaps * m_outCaps
Definition: sources/gst-plugins/gst-nvdsvideotemplate/includes/nvdscustomlib_interface.hpp:35
DSCustom_CreateParams::m_gpuId
guint m_gpuId
Definition: sources/gst-plugins/gst-nvdsvideotemplate/includes/nvdscustomlib_interface.hpp:36
IDSCustomLibrary::ProcessBuffer
virtual BufferResult ProcessBuffer(GstBuffer *inbuf)=0
IDSCustomLibrary::HandleEvent
virtual bool HandleEvent(GstEvent *event)=0
Property::Property
Property(std::string arg_key, std::string arg_value)
Definition: 9.2/sources/gst-plugins/gst-nvdsvideotemplate/includes/nvdscustomlib_interface.hpp:44
IDSCustomLibrary::~IDSCustomLibrary
virtual ~IDSCustomLibrary()
Definition: 9.2/sources/gst-plugins/gst-nvdsvideotemplate/includes/nvdscustomlib_interface.hpp:64
DSCustom_CreateParams::m_fillDummyBatchMeta
gboolean m_fillDummyBatchMeta
Definition: sources/gst-plugins/gst-nvdsvideotemplate/includes/nvdscustomlib_interface.hpp:39
BufferResult::Buffer_Error
@ Buffer_Error
BufferResult::Buffer_Async
@ Buffer_Async
IDSCustomLibrary::GetCompatibleCaps
virtual GstCaps * GetCompatibleCaps(GstPadDirection direction, GstCaps *in_caps, GstCaps *othercaps)=0
BufferResult::Buffer_Drop
@ Buffer_Drop
IDSCustomLibrary::QueryProperties
virtual char * QueryProperties()=0
DSCustom_CreateParams::m_dummyMetaInsert
gboolean m_dummyMetaInsert
Definition: sources/gst-plugins/gst-nvdsvideotemplate/includes/nvdscustomlib_interface.hpp:38
BufferResult
BufferResult
Definition: sources/gst-plugins/gst-nvdspostprocess/includes/nvdspostprocesslib_interface.hpp:24