NVIDIA DeepStream SDK API Reference

7.0 Release
nvdscustomlib_base.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: MIT
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 #ifndef __NVDSCUSTOMLIB_BASE_HPP__
25 #define __NVDSCUSTOMLIB_BASE_HPP__
26 
27 #include <gst/audio/audio.h>
28 #include <gst/base/gstbasetransform.h>
29 
31 
32 /* Buffer Pool Configuration Parameters */
35  guint gpu_id;
36  guint max_buffers;
37  gint batch_size;
38 };
39 
41  public:
42  explicit DSCustomLibraryBase(GstBaseTransform* btrans = nullptr);
43 
44  /* Set Init Parameters */
45  virtual bool SetInitParams(DSCustom_CreateParams *params);
46 
47  virtual ~DSCustomLibraryBase();
48 
49  virtual bool HandleEvent(GstEvent *event) = 0;
50 
51  virtual char* QueryProperties () = 0;
52 
53  /* Set Custom Properties of the library */
54  virtual bool SetProperty(Property &prop) = 0;
55  // TODO: Add getProperty as well
56 
57  /* Get GetCompatibleOutputCaps */
58  virtual GstCaps *GetCompatibleCaps(GstPadDirection direction,
59  GstCaps *in_caps, GstCaps *othercaps);
60 
61  /* Process Incoming Buffer */
62  virtual BufferResult ProcessBuffer(GstBuffer *inbuf) = 0;
63 
64  public:
65  /* Gstreamer dsexaple2 plugin's base class reference */
66  GstBaseTransform *m_element;
67 
69  guint m_gpuId;
70 
71  /* Audio Information */
72  GstAudioInfo m_inAudioInfo;
73  GstAudioInfo m_outAudioInfo;
74 
75  /* Audio Format Information */
76  GstAudioFormat m_inAudioFmt;
77  GstAudioFormat m_outAudioFmt;
78 
79  /* Gst Caps Information */
80  GstCaps *m_inCaps;
81  GstCaps *m_outCaps;
82 };
83 
84 #endif
DSCustomLibraryBase::ProcessBuffer
virtual BufferResult ProcessBuffer(GstBuffer *inbuf)=0
DSCustom_CreateParams
Definition: gst-nvdsA2Vtemplate/includes/nvdscustomlib_interface.hpp:29
DSCustomLibraryBase::m_inAudioFmt
GstAudioFormat m_inAudioFmt
Definition: nvdscustomlib_base.h:76
DSCustomLibraryBase::m_outCaps
GstCaps * m_outCaps
Definition: nvdscustomlib_base.h:81
DSCustomLibraryBase::m_outAudioFmt
GstAudioFormat m_outAudioFmt
Definition: nvdscustomlib_base.h:77
BufferPoolConfig::batch_size
gint batch_size
Definition: nvdscustomlib_base.h:37
BufferResult
BufferResult
Definition: gst-nvdsA2Vtemplate/includes/nvdscustomlib_interface.hpp:22
nvdscustomlib_interface.hpp
DSCustomLibraryBase::m_outAudioInfo
GstAudioInfo m_outAudioInfo
Definition: nvdscustomlib_base.h:73
DSCustomLibraryBase::m_element
GstBaseTransform * m_element
Definition: nvdscustomlib_base.h:66
DSCustomLibraryBase::SetProperty
virtual bool SetProperty(Property &prop)=0
DSCustomLibraryBase::QueryProperties
virtual char * QueryProperties()=0
DSCustomLibraryBase::m_inCaps
GstCaps * m_inCaps
Definition: nvdscustomlib_base.h:80
IDSCustomLibrary
Definition: gst-nvdsA2Vtemplate/includes/nvdscustomlib_interface.hpp:43
BufferPoolConfig
Definition: nvdscustomlib_base.h:33
DSCustomLibraryBase::~DSCustomLibraryBase
virtual ~DSCustomLibraryBase()
Definition: gst-nvdsA2Vtemplate/includes/nvdscustomlib_base.hpp:65
DSCustomLibraryBase::GetCompatibleCaps
virtual GstCaps * GetCompatibleCaps(GstPadDirection direction, GstCaps *in_caps, GstCaps *othercaps)
Definition: gst-nvdsvideotemplate/includes/nvdscustomlib_base.hpp:126
Property
Definition: gst-nvdsA2Vtemplate/includes/nvdscustomlib_interface.hpp:33
DSCustomLibraryBase::DSCustomLibraryBase
DSCustomLibraryBase(GstBaseTransform *btrans=nullptr)
Definition: gst-nvdsvideotemplate/includes/nvdscustomlib_base.hpp:97
BufferPoolConfig::max_buffers
guint max_buffers
Definition: nvdscustomlib_base.h:36
BufferPoolConfig::cuda_mem_type
gint cuda_mem_type
Definition: nvdscustomlib_base.h:34
BufferPoolConfig::gpu_id
guint gpu_id
Definition: nvdscustomlib_base.h:35
DSCustomLibraryBase::HandleEvent
virtual bool HandleEvent(GstEvent *event)=0
DSCustomLibraryBase::m_gpuId
guint m_gpuId
GPU ID on which we expect to execute the algorithm.
Definition: nvdscustomlib_base.h:69
GstBuffer
struct _GstBuffer GstBuffer
Definition: idatatype.h:19
DSCustomLibraryBase::m_inAudioInfo
GstAudioInfo m_inAudioInfo
Definition: nvdscustomlib_base.h:72
DSCustomLibraryBase::SetInitParams
virtual bool SetInitParams(DSCustom_CreateParams *params)
Definition: gst-nvdsA2Vtemplate/includes/nvdscustomlib_base.hpp:59
DSCustomLibraryBase
Definition: nvdscustomlib_base.h:40