Skip to content

Commit 3da377c

Browse files
mholowniyunowo
authored andcommitted
Merge gvamotiondetect into gstvideoanalytics library (#511)
* Merge gvamotiondetect into gstvideoanalytics library * fix fedora build * delete unused imports * delete fedora fix - move fix to another PR * Fix fedora docker build (#517) * Fix fedora docker build * more fixes * remove unused library, fix build
1 parent 87ca57c commit 3da377c

File tree

6 files changed

+32
-119
lines changed

6 files changed

+32
-119
lines changed

src/monolithic/gst/elements/CMakeLists.txt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ pkg_check_modules(GSTREAMER gstreamer-1.0>=1.16 REQUIRED)
1212
pkg_check_modules(GSTVIDEO gstreamer-video-1.0>=1.16 REQUIRED)
1313
pkg_check_modules(GSTALLOC gstreamer-allocators-1.0 REQUIRED)
1414
pkg_search_module(VA va libva REQUIRED)
15+
if(NOT MSVC)
16+
pkg_check_modules(GSTVA REQUIRED IMPORTED_TARGET gstreamer-va-1.0)
17+
endif()
1518
if(${ENABLE_AUDIO_INFERENCE_ELEMENTS})
1619
pkg_check_modules(GSTAUDIO gstreamer-audio-1.0>=1.16 REQUIRED)
1720
endif()
@@ -31,6 +34,13 @@ file (GLOB MAIN_SRC
3134
gvadeskew/*.c
3235
)
3336

37+
# gvamotiondetect platform-specific source
38+
if(MSVC OR WIN32)
39+
list(APPEND MAIN_SRC gvamotiondetect/gvamotiondetect_win.cpp)
40+
else()
41+
list(APPEND MAIN_SRC gvamotiondetect/gvamotiondetect.cpp)
42+
endif()
43+
3444
file (GLOB MAIN_HEADERS
3545
gvametaconvert/*.h
3646
gvametaaggregate/*.h
@@ -39,6 +49,7 @@ file (GLOB MAIN_HEADERS
3949
gvawatermark/renderer/cpu/*.h
4050
gvawatermark3d/*.h
4151
gvadeskew/*.h
52+
gvamotiondetect/*.h
4253
)
4354

4455
if(${ENABLE_AUDIO_INFERENCE_ELEMENTS})
@@ -64,6 +75,7 @@ PUBLIC
6475
gvametaaggregate
6576
gvawatermark3d
6677
gvadeskew
78+
gvamotiondetect
6779
PRIVATE
6880
${GSTREAMER_INCLUDE_DIRS}
6981
${GSTVIDEO_INCLUDE_DIRS}
@@ -91,8 +103,17 @@ PRIVATE
91103
json-hpp
92104
json-schema-validator
93105
utils
106+
dlstreamer_gst_meta
107+
gstvideoanalyticsmeta
94108
)
95109

110+
if(NOT MSVC)
111+
target_link_libraries(${TARGET_NAME} PRIVATE
112+
${GSTVA_LIBRARIES}
113+
dlstreamer_vaapi
114+
)
115+
endif()
116+
96117
if(${ENABLE_AUDIO_INFERENCE_ELEMENTS})
97118
target_link_libraries(${TARGET_NAME} PRIVATE ${GSTAUDIO_LIBRARIES})
98119
endif()
@@ -109,7 +130,6 @@ add_subdirectory(gvaattachroi)
109130
add_subdirectory(gvametapublish)
110131
add_subdirectory(gvapython)
111132
add_subdirectory(gvatrack)
112-
add_subdirectory(gvamotiondetect)
113133
if(ENABLE_REALSENSE)
114134
add_subdirectory(gvarealsense)
115135
endif()

src/monolithic/gst/elements/gvamotiondetect/CMakeLists.txt

Lines changed: 0 additions & 92 deletions
This file was deleted.

src/monolithic/gst/elements/gvamotiondetect/gvamotiondetect.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (C) 2025 Intel Corporation
2+
* Copyright (C) 2025-2026 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
******************************************************************************/
@@ -275,7 +275,7 @@ static GstCaps *gst_gva_motion_detect_transform_caps(GstBaseTransform *, GstPadD
275275
// -----------------------------------------------------------------------------
276276
// VA API helper functions
277277
// Map GST buffer to VA surface (using mapper + fallback) and return VASurfaceID
278-
static VASurfaceID gva_motion_detect_get_surface(GstGvaMotionDetect *self, GstBuffer *buf) {
278+
static VASurfaceID gva_motion_detect_get_surface([[maybe_unused]] GstGvaMotionDetect *self, GstBuffer *buf) {
279279
if (!buf)
280280
return VA_INVALID_SURFACE;
281281
VASurfaceID sid = gst_va_buffer_get_surface(buf);
@@ -308,8 +308,8 @@ static bool gva_motion_detect_convert_from_surface(GstGvaMotionDetect *self, VAS
308308
}
309309

310310
// Write cv::UMat back into the VA surface; returns false on failure
311-
static bool gva_motion_detect_write_to_surface(GstGvaMotionDetect *self, const cv::UMat &src, VASurfaceID sid,
312-
int width, int height) {
311+
[[maybe_unused]] static bool gva_motion_detect_write_to_surface(GstGvaMotionDetect *self, const cv::UMat &src,
312+
VASurfaceID sid, int width, int height) {
313313
if (sid == VA_INVALID_SURFACE || !self->va_dpy)
314314
return false;
315315
try {
@@ -453,7 +453,8 @@ static gboolean gst_gva_motion_detect_start(GstBaseTransform *trans) {
453453
return TRUE;
454454
}
455455

456-
static gboolean gst_gva_motion_detect_set_caps(GstBaseTransform *trans, GstCaps *incaps, GstCaps *outcaps) {
456+
static gboolean gst_gva_motion_detect_set_caps(GstBaseTransform *trans, GstCaps *incaps,
457+
[[maybe_unused]] GstCaps *outcaps) {
457458
GstGvaMotionDetect *self = GST_GVA_MOTION_DETECT(trans);
458459
if (!gst_video_info_from_caps(&self->vinfo, incaps))
459460
return FALSE;
@@ -1115,10 +1116,3 @@ static void gst_gva_motion_detect_process_and_attach(GstGvaMotionDetect *self, G
11151116
if (!stable.empty())
11161117
gst_gva_motion_detect_attach_rois(self, buf, stable, width, height);
11171118
}
1118-
1119-
static gboolean plugin_init(GstPlugin *plugin) {
1120-
return gst_element_register(plugin, "gvamotiondetect", GST_RANK_NONE, GST_TYPE_GVA_MOTION_DETECT);
1121-
}
1122-
1123-
GST_PLUGIN_DEFINE(GST_VERSION_MAJOR, GST_VERSION_MINOR, gvamotiondetect, PRODUCT_FULL_NAME " gvamotiondetect element",
1124-
plugin_init, PLUGIN_VERSION, PLUGIN_LICENSE, PACKAGE_NAME, GST_PACKAGE_ORIGIN)

src/monolithic/gst/elements/gvamotiondetect/gvamotiondetect_win.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (C) 2025 Intel Corporation
3-
*
4-
* SPDX-License-Identifier: MIT
5-
******************************************************************************/
6-
7-
/*******************************************************************************
8-
* Copyright (C) 2025 Intel Corporation
2+
* Copyright (C) 2025-2026 Intel Corporation
93
*
104
* SPDX-License-Identifier: MIT
115
******************************************************************************/
@@ -573,10 +567,3 @@ static void gst_gva_motion_detect_init(GstGvaMotionDetect *self) {
573567
self->frame_index = 0;
574568
g_mutex_init(&self->meta_mutex);
575569
}
576-
577-
static gboolean plugin_init(GstPlugin *plugin) {
578-
return gst_element_register(plugin, "gvamotiondetect", GST_RANK_NONE, GST_TYPE_GVA_MOTION_DETECT);
579-
}
580-
581-
GST_PLUGIN_DEFINE(GST_VERSION_MAJOR, GST_VERSION_MINOR, gvamotiondetect, PRODUCT_FULL_NAME " gvamotiondetect element",
582-
plugin_init, PLUGIN_VERSION, PLUGIN_LICENSE, PACKAGE_NAME, GST_PACKAGE_ORIGIN)

src/monolithic/gst/registrator/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ PRIVATE
3434
${CMAKE_CURRENT_SOURCE_DIR}/../elements/gvatrack/
3535
${CMAKE_CURRENT_SOURCE_DIR}/../elements/gvawatermark/
3636
${CMAKE_CURRENT_SOURCE_DIR}/../elements/gvawatermark3d/
37+
${CMAKE_CURRENT_SOURCE_DIR}/../elements/gvamotiondetect/
3738
${CMAKE_CURRENT_SOURCE_DIR}/../elements/gvadeskew/
3839
)
3940

src/monolithic/gst/registrator/register_elements.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "gstgvatrack.h"
2323
#include "gstgvawatermarkimpl.h"
2424
#include "gvadeskew.h"
25+
#include "gvamotiondetect.h"
2526
#include "gvawatermark.h"
2627
#include "gvawatermark3d.h"
2728
#include "inference_backend/logger.h"
@@ -67,6 +68,8 @@ static gboolean plugin_init(GstPlugin *plugin) {
6768
return FALSE;
6869
if (!gst_element_register(plugin, "gvawatermark3d", GST_RANK_NONE, GST_TYPE_GVAWATERMARK3D))
6970
return FALSE;
71+
if (!gst_element_register(plugin, "gvamotiondetect", GST_RANK_NONE, GST_TYPE_GVA_MOTION_DETECT))
72+
return FALSE;
7073
#if _MSC_VER
7174
if (!gst_element_register(plugin, "gvametapublish", GST_RANK_NONE, GST_TYPE_GVA_META_PUBLISH))
7275
return FALSE;

0 commit comments

Comments
 (0)