NVIDIA DeepStream SDK API Reference

6.4 Release
nvdspostprocesslib_base.hpp
Go to the documentation of this file.
1 
23 #ifndef __NVDSPOSTPROCESSLIB_BASE_HPP__
24 #define __NVDSPOSTPROCESSLIB_BASE_HPP__
25 
26 #include <gst/base/gstbasetransform.h>
27 #include <gst/video/video.h>
28 
29 #include "gstnvdsbufferpool.h"
31 
33 {
34 public:
36 
38 
39  virtual ~DSPostProcessLibraryBase();
40 
41  virtual bool HandleEvent (GstEvent *event) = 0;
42 
43  virtual bool SetConfigFile (const gchar *config_file) = 0;
44 
45  /* Process Incoming Buffer */
46  virtual BufferResult ProcessBuffer(GstBuffer *inbuf) = 0;
47 
48 public:
49  /* Gstreamer dsexaple2 plugin's base class reference */
50  GstBaseTransform *m_element;
51 
53  guint m_gpuId;
54 
56 
57 };
58 
59 
61  m_element = NULL;
62  m_gpuId = 0;
63  m_cudaStream = 0;
64 }
65 
67  if (params){
68  m_element = params->m_element;
69  m_gpuId = params->m_gpuId;
70  m_cudaStream = params->m_cudaStream;
71  }
72  else {
73  m_element = NULL;
74  m_gpuId = 0;
75  m_cudaStream = 0;
76  }
77 }
78 
80 }
81 
82 /* Helped function to get the NvBufSurface from the GstBuffer */
84 {
85  GstMapInfo in_map_info;
86  NvBufSurface *nvbuf_surface = NULL;
87 
88  /* Map the buffer contents and get the pointer to NvBufSurface. */
89  if (!gst_buffer_map (inbuf, &in_map_info, GST_MAP_READ)) {
90  printf ("%s:gst buffer map to get pointer to NvBufSurface failed", __func__);
91  return NULL;
92  }
93 
94  // Assuming that the plugin uses DS NvBufSurface data structure
95  nvbuf_surface = (NvBufSurface *) in_map_info.data;
96 
97  gst_buffer_unmap(inbuf, &in_map_info);
98  return nvbuf_surface;
99 }
100 
101 #endif
IDSPostProcessLibrary
Definition: nvdspostprocesslib_interface.hpp:52
NvBufSurface
Holds information about batched buffers.
Definition: nvbufsurface.h:503
BufferResult
BufferResult
Copyright (c) 2023, NVIDIA CORPORATION.
Definition: gst-nvdsA2Vtemplate/includes/nvdscustomlib_interface.hpp:32
DSPostProcessLibraryBase::m_cudaStream
cudaStream_t m_cudaStream
Definition: nvdspostprocesslib_base.hpp:55
DSPostProcess_CreateParams::m_gpuId
guint m_gpuId
Definition: nvdspostprocesslib_interface.hpp:38
DSPostProcessLibraryBase
Copyright (c) 2022, NVIDIA CORPORATION.
Definition: nvdspostprocesslib_base.hpp:32
DSPostProcess_CreateParams::m_cudaStream
cudaStream_t m_cudaStream
Definition: nvdspostprocesslib_interface.hpp:39
DSPostProcess_CreateParams::m_element
GstBaseTransform * m_element
Definition: nvdspostprocesslib_interface.hpp:37
cudaStream_t
struct CUstream_st * cudaStream_t
Forward declaration of cudaStream_t.
Definition: nvbufsurftransform.h:29
DSPostProcessLibraryBase::~DSPostProcessLibraryBase
virtual ~DSPostProcessLibraryBase()
Definition: nvdspostprocesslib_base.hpp:79
DSPostProcessLibraryBase::DSPostProcessLibraryBase
DSPostProcessLibraryBase()
Definition: nvdspostprocesslib_base.hpp:60
DSPostProcess_CreateParams
Definition: nvdspostprocesslib_interface.hpp:36
DSPostProcessLibraryBase::m_gpuId
guint m_gpuId
GPU ID on which we expect to execute the algorithm.
Definition: nvdspostprocesslib_base.hpp:53
DSPostProcessLibraryBase::m_element
GstBaseTransform * m_element
Definition: nvdspostprocesslib_base.hpp:50
nvdspostprocesslib_interface.hpp
DSPostProcessLibraryBase::SetConfigFile
virtual bool SetConfigFile(const gchar *config_file)=0
DSPostProcessLibraryBase::HandleEvent
virtual bool HandleEvent(GstEvent *event)=0
GstBuffer
struct _GstBuffer GstBuffer
Definition: idatatype.h:19
DSPostProcessLibraryBase::ProcessBuffer
virtual BufferResult ProcessBuffer(GstBuffer *inbuf)=0
gstnvdsbufferpool.h
getNvBufSurface
static NvBufSurface * getNvBufSurface(GstBuffer *inbuf)
Definition: nvdspostprocesslib_base.hpp:83