Modifying the gst-dsexample

I have a need to build a custom plugin, I’m currently modifying the gst-dsexample, currently named gst-dsexample2 or dsexample2. Just trying to modify and compile a new plugin.

The problem is that I’m not able to find the dsexample2 I’ve built. Similar as: renaming custom gst-dsexample which seems to be outdated.

The steps I’ve taken is to copy the gst-dsexample directory, renamed as gst-dsexample2
Renamed gstdsexample.cpp as gstdsexample2.cpp, gstdsexample.h as gstdsexample2.h.

In gstdsexample2.cpp I’ve edited:

#include "gstdsexample2.h"
static gboolean
dsexample_plugin_init (GstPlugin * plugin)
{
  GST_DEBUG_CATEGORY_INIT (gst_dsexample_debug, "dsexample2", 0,
      "dsexample2 plugin");

  return gst_element_register (plugin, "dsexample2", GST_RANK_PRIMARY,
      GST_TYPE_DSEXAMPLE);
}

in gstdsexample2.h I’ve edited:

#define PACKAGE "dsexample2"

in Makefile I’ve edited:

ifeq ($(USE_OPTIMIZED_DSEXAMPLE),1)
  SRCS:= gstdsexample_optimized.cpp
else
  SRCS:= gstdsexample2.cpp
endif

INCS:= $(wildcard *.h)
LIB:=libnvdsgst_dsexample2.so

Then I execute

export CUDA_VER=10.2
make
make install

However when I try to inspect dsexample2 I’m not able to find it, gst-inspect-1.0 dsexample2:

No such element or plugin 'dsexample2'

You need to modify all “dsexample” to “dsexample2”, including the type, the class,…
dsexample_plugin_init should be changed to dsexample2_plugin_init, gst_dsexample_debug should be changed to gst_dsexample2_debug

The most important one is:
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
nvdsgst_dsexample2,
DESCRIPTION, dsexample2_plugin_init, DS_VERSION, LICENSE, BINARY_PACKAGE, URL)

This is not deepstream topic. Please refer to Plugin Writer's Guide