From d92e7bdb1118be366de0e933b9648fb9d81e9553 Mon Sep 17 00:00:00 2001 From: Barzan Hayati Date: Mon, 30 Jun 2025 19:15:47 +0000 Subject: [PATCH] Create gstdsexample --- CMakeLists.txt | 4 +++- src/gstds_example_manager.cpp | 13 +++++++++++++ src/gstds_example_manager.hpp | 10 ++++++++++ src/pipeline_manager.cpp | 3 +++ src/pipeline_manager.hpp | 2 ++ 5 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/gstds_example_manager.cpp create mode 100644 src/gstds_example_manager.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d60f78b..6beb15f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,9 +50,11 @@ include_directories(${PROJECT_SOURCE_DIR}/camera_manager.hpp) include_directories(${PROJECT_SOURCE_DIR}/pipeline_manager.hpp) include_directories(${PROJECT_SOURCE_DIR}/streammux_manager.hpp) include_directories(${PROJECT_SOURCE_DIR}/source_bin.hpp) +include_directories(${PROJECT_SOURCE_DIR}/gstds_example_manager.hpp) -set(SOURCES src/main.cpp src/camera_manager.cpp src/pipeline_manager.cpp src/streammux_manager.cpp src/source_bin.cpp) + +set(SOURCES src/main.cpp src/camera_manager.cpp src/pipeline_manager.cpp src/streammux_manager.cpp src/source_bin.cpp src/gstds_example_manager.cpp) # Create the executable add_executable(${PROJECT_NAME} ${SOURCES}) diff --git a/src/gstds_example_manager.cpp b/src/gstds_example_manager.cpp new file mode 100644 index 0000000..8e6bdff --- /dev/null +++ b/src/gstds_example_manager.cpp @@ -0,0 +1,13 @@ +#include "gstds_example_manager.hpp" + +GstdsExampleManager::GstdsExampleManager() {} + +bool GstdsExampleManager::create_gstds_example() { + custom_plugin = gst_element_factory_make("dsexample", "nvdsgst_dsexample"); + g_object_set(G_OBJECT(custom_plugin), "full-frame", 0, NULL); + if (!custom_plugin) { + g_printerr("Custom_plugin could not be created. Exiting.\n"); + return false; + } + return true; +} \ No newline at end of file diff --git a/src/gstds_example_manager.hpp b/src/gstds_example_manager.hpp new file mode 100644 index 0000000..e6dbb02 --- /dev/null +++ b/src/gstds_example_manager.hpp @@ -0,0 +1,10 @@ +#include + +class GstdsExampleManager { + private: + public: + GstElement *custom_plugin = NULL; + GstdsExampleManager(); + bool create_gstds_example(); + ~GstdsExampleManager(); +}; \ No newline at end of file diff --git a/src/pipeline_manager.cpp b/src/pipeline_manager.cpp index dc08632..20974c5 100644 --- a/src/pipeline_manager.cpp +++ b/src/pipeline_manager.cpp @@ -56,5 +56,8 @@ bool PipelineManager::create_pipeline_elements(int num_sources, // g_source_bin_list[i] = source_bin; gst_bin_add(GST_BIN(pipeline), source_bin); } + + gstds_example_manager->create_gstds_example(); + return true; } \ No newline at end of file diff --git a/src/pipeline_manager.hpp b/src/pipeline_manager.hpp index c8a9509..80e5a00 100644 --- a/src/pipeline_manager.hpp +++ b/src/pipeline_manager.hpp @@ -2,6 +2,7 @@ #include #include "cuda_runtime_api.h" +#include "gstds_example_manager.hpp" #include "source_bin.hpp" #include "streammux_manager.hpp" @@ -12,6 +13,7 @@ class PipelineManager { GstElement *pipeline = NULL; GMutex eos_lock; StreammuxManager *streammux_manager = new StreammuxManager(); + GstdsExampleManager *gstds_example_manager = new GstdsExampleManager(); public: int current_device = -1;