Create nvvideoconvert
This commit is contained in:
parent
e12a3096af
commit
638177c8d1
@ -52,10 +52,11 @@ 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)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/tiler_manager.hpp)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/nv_video_convert_manager.hpp)
|
||||
|
||||
|
||||
|
||||
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 src/tiler_manager.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 src/tiler_manager.cpp
|
||||
src/nv_video_convert_manager.cpp)
|
||||
# Create the executable
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
|
||||
|
||||
18
src/nv_video_convert_manager.cpp
Normal file
18
src/nv_video_convert_manager.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "nv_video_convert_manager.hpp"
|
||||
|
||||
#define SET_GPU_ID(object, gpu_id) \
|
||||
g_object_set(G_OBJECT(object), "gpu-id", gpu_id, NULL);
|
||||
#define GPU_ID 0
|
||||
|
||||
NvVideoConvertManager::NvVideoConvertManager() {}
|
||||
|
||||
bool NvVideoConvertManager::create_nv_video_convert() {
|
||||
/* Use convertor to convert from NV12 to RGBA as required by nvosd */
|
||||
nvvidconv = gst_element_factory_make("nvvideoconvert", "nvvideo-converter");
|
||||
SET_GPU_ID(nvvidconv, GPU_ID);
|
||||
if (!nvvidconv) {
|
||||
g_printerr("Could not create nvvideoconvert.Exiting. \n");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
10
src/nv_video_convert_manager.hpp
Normal file
10
src/nv_video_convert_manager.hpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include <gst/gst.h>
|
||||
|
||||
class NvVideoConvertManager {
|
||||
private:
|
||||
public:
|
||||
GstElement *nvvidconv = NULL;
|
||||
NvVideoConvertManager();
|
||||
bool create_nv_video_convert();
|
||||
~NvVideoConvertManager();
|
||||
};
|
||||
@ -61,6 +61,7 @@ bool PipelineManager::create_pipeline_elements(int num_sources,
|
||||
tiler_manager->create_tiler(num_sources,
|
||||
streammux_manager->MUXER_OUTPUT_WIDTH,
|
||||
streammux_manager->MUXER_OUTPUT_HEIGHT);
|
||||
nv_video_convert_manager->create_nv_video_convert();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
#include "cuda_runtime_api.h"
|
||||
#include "gstds_example_manager.hpp"
|
||||
#include "nv_video_convert_manager.hpp"
|
||||
#include "source_bin.hpp"
|
||||
#include "streammux_manager.hpp"
|
||||
#include "tiler_manager.hpp"
|
||||
@ -16,6 +17,8 @@ class PipelineManager {
|
||||
StreammuxManager *streammux_manager = new StreammuxManager();
|
||||
GstdsExampleManager *gstds_example_manager = new GstdsExampleManager();
|
||||
TilerManager *tiler_manager = new TilerManager();
|
||||
NvVideoConvertManager *nv_video_convert_manager =
|
||||
new NvVideoConvertManager();
|
||||
|
||||
public:
|
||||
int current_device = -1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user