NVIDIA DeepStream SDK API Reference

7.0 Release
gst-nvdsspeech/includes/nvdscustomlib_interface.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2020-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 __NVDS_SPEECH_CUSTOMLIB_INTERFACE_HPP__
25 #define __NVDS_SPEECH_CUSTOMLIB_INTERFACE_HPP__
26 
27 #include <gst/base/gstbasetransform.h>
28 #include <gst/gstbuffer.h>
29 #include <string>
30 
31 #define NVDS_CONFIG_FILE_PROPERTY "config-file"
32 
33 namespace nvdsspeech {
34 
35 enum class BufferResult {
36  Buffer_Ok, // Push the buffer from submit_input function
37  Buffer_Drop, // Drop the buffer inside submit_input function
38  Buffer_Async, // Return from submit_input function, custom lib to push the
39  // buffer
40  Buffer_Error // Error occured
41 };
42 
44  GstBaseTransform* m_element;
45  GstCaps* m_inCaps;
46  GstCaps* m_outCaps;
47 };
48 
49 struct Property {
50  Property(std::string arg_key, std::string arg_value)
51  : key(arg_key), value(arg_value)
52  {
53  }
54 
55  std::string key;
56  std::string value;
57 };
58 
59 enum class CapsType : int {
60  kNone = 0,
61  kAudio,
62  kText,
63 };
64 
66 public:
67  virtual bool SetProperty(const Property& prop) = 0;
68  virtual bool Initialize() = 0;
69  virtual GstCaps* GetCompatibleCaps(
70  GstPadDirection direction, GstCaps* in_caps, GstCaps* othercaps) = 0;
71  virtual bool StartWithParams(DSCustom_CreateParams* params) = 0;
72  virtual bool HandleEvent(GstEvent* event) = 0;
73  virtual BufferResult ProcessBuffer(GstBuffer* inbuf) = 0;
74  virtual ~IDSCustomLibrary(){};
75 };
76 
77 } // namespace nvdsspeech
78 
79 #endif
nvdsspeech::CapsType::kText
@ kText
nvdsspeech::DSCustom_CreateParams::m_outCaps
GstCaps * m_outCaps
Definition: gst-nvdsspeech/includes/nvdscustomlib_interface.hpp:46
nvdsspeech::BufferResult
BufferResult
Definition: gst-nvdsspeech/includes/nvdscustomlib_interface.hpp:35
nvdsspeech::IDSCustomLibrary::Initialize
virtual bool Initialize()=0
nvdsspeech::Property
Definition: gst-nvdsspeech/includes/nvdscustomlib_interface.hpp:49
nvdsspeech::BufferResult::Buffer_Error
@ Buffer_Error
nvdsspeech::IDSCustomLibrary::GetCompatibleCaps
virtual GstCaps * GetCompatibleCaps(GstPadDirection direction, GstCaps *in_caps, GstCaps *othercaps)=0
nvdsspeech::DSCustom_CreateParams::m_element
GstBaseTransform * m_element
Definition: gst-nvdsspeech/includes/nvdscustomlib_interface.hpp:44
nvdsspeech::IDSCustomLibrary::SetProperty
virtual bool SetProperty(const Property &prop)=0
nvdsspeech::DSCustom_CreateParams::m_inCaps
GstCaps * m_inCaps
Definition: gst-nvdsspeech/includes/nvdscustomlib_interface.hpp:45
nvdsspeech::CapsType
CapsType
Definition: gst-nvdsspeech/includes/nvdscustomlib_interface.hpp:59
nvdsspeech::IDSCustomLibrary::~IDSCustomLibrary
virtual ~IDSCustomLibrary()
Definition: gst-nvdsspeech/includes/nvdscustomlib_interface.hpp:74
nvdsspeech
Definition: gst-nvdsspeech/includes/nvdscustomlib_interface.hpp:33
nvdsspeech::IDSCustomLibrary
Definition: gst-nvdsspeech/includes/nvdscustomlib_interface.hpp:65
nvdsspeech::IDSCustomLibrary::StartWithParams
virtual bool StartWithParams(DSCustom_CreateParams *params)=0
nvdsspeech::Property::key
std::string key
Definition: gst-nvdsspeech/includes/nvdscustomlib_interface.hpp:55
nvdsspeech::BufferResult::Buffer_Ok
@ Buffer_Ok
nvdsspeech::IDSCustomLibrary::ProcessBuffer
virtual BufferResult ProcessBuffer(GstBuffer *inbuf)=0
nvdsspeech::BufferResult::Buffer_Async
@ Buffer_Async
nvdsspeech::Property::value
std::string value
Definition: gst-nvdsspeech/includes/nvdscustomlib_interface.hpp:56
nvdsspeech::CapsType::kNone
@ kNone
nvdsspeech::Property::Property
Property(std::string arg_key, std::string arg_value)
Definition: gst-nvdsspeech/includes/nvdscustomlib_interface.hpp:50
GstBuffer
struct _GstBuffer GstBuffer
Definition: idatatype.h:19
nvdsspeech::CapsType::kAudio
@ kAudio
nvdsspeech::DSCustom_CreateParams
Definition: gst-nvdsspeech/includes/nvdscustomlib_interface.hpp:43
nvdsspeech::IDSCustomLibrary::HandleEvent
virtual bool HandleEvent(GstEvent *event)=0
nvdsspeech::BufferResult::Buffer_Drop
@ Buffer_Drop