From 0d3d8d28181966fc069163a3aef667edec3a4180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Wed, 24 Jan 2024 21:12:17 -0500 Subject: [PATCH] analytics: Move tensor meta to the analytics library --- .../ext/onnx/decoders/gstssdobjectdetector.c | 1 - subprojects/gst-plugins-bad/ext/onnx/gstonnx.c | 1 - .../gst-plugins-bad/ext/onnx/gstonnxclient.h | 2 +- subprojects/gst-plugins-bad/ext/onnx/meson.build | 1 - .../gst-libs/gst/analytics/analytics.h | 1 + .../gst/analytics}/gsttensormeta.c | 0 .../gst/analytics}/gsttensormeta.h | 13 ++++++++++++- .../gst-libs/gst/analytics/meson.build | 7 +++++-- 8 files changed, 19 insertions(+), 7 deletions(-) rename subprojects/gst-plugins-bad/{ext/onnx/tensor => gst-libs/gst/analytics}/gsttensormeta.c (100%) rename subprojects/gst-plugins-bad/{ext/onnx/tensor => gst-libs/gst/analytics}/gsttensormeta.h (94%) diff --git a/subprojects/gst-plugins-bad/ext/onnx/decoders/gstssdobjectdetector.c b/subprojects/gst-plugins-bad/ext/onnx/decoders/gstssdobjectdetector.c index 9019bf863a..d1a8a23a25 100644 --- a/subprojects/gst-plugins-bad/ext/onnx/decoders/gstssdobjectdetector.c +++ b/subprojects/gst-plugins-bad/ext/onnx/decoders/gstssdobjectdetector.c @@ -51,7 +51,6 @@ #include #include #include -#include "tensor/gsttensormeta.h" /* Object detection tensor id strings */ #define GST_MODEL_OBJECT_DETECTOR_BOXES "Gst.Model.ObjectDetector.Boxes" diff --git a/subprojects/gst-plugins-bad/ext/onnx/gstonnx.c b/subprojects/gst-plugins-bad/ext/onnx/gstonnx.c index 0f567b7ad1..f7ba3fc51a 100644 --- a/subprojects/gst-plugins-bad/ext/onnx/gstonnx.c +++ b/subprojects/gst-plugins-bad/ext/onnx/gstonnx.c @@ -26,7 +26,6 @@ #include "decoders/gstssdobjectdetector.h" #include "gstonnxinference.h" -#include "tensor/gsttensormeta.h" static gboolean plugin_init (GstPlugin * plugin) diff --git a/subprojects/gst-plugins-bad/ext/onnx/gstonnxclient.h b/subprojects/gst-plugins-bad/ext/onnx/gstonnxclient.h index bdec9f1a3b..f0d480cdda 100644 --- a/subprojects/gst-plugins-bad/ext/onnx/gstonnxclient.h +++ b/subprojects/gst-plugins-bad/ext/onnx/gstonnxclient.h @@ -23,10 +23,10 @@ #define __GST_ONNX_CLIENT_H__ #include +#include #include #include #include "gstml.h" -#include "tensor/gsttensormeta.h" GST_DEBUG_CATEGORY_EXTERN (onnx_inference_debug); diff --git a/subprojects/gst-plugins-bad/ext/onnx/meson.build b/subprojects/gst-plugins-bad/ext/onnx/meson.build index ceb0b9a85c..58c3430dec 100644 --- a/subprojects/gst-plugins-bad/ext/onnx/meson.build +++ b/subprojects/gst-plugins-bad/ext/onnx/meson.build @@ -18,7 +18,6 @@ if onnxrt_dep.found() 'decoders/gstssdobjectdetector.c', 'gstonnxinference.cpp', 'gstonnxclient.cpp', - 'tensor/gsttensormeta.c', c_args : gst_plugins_bad_args + extra_args, cpp_args : gst_plugins_bad_args + extra_args, link_args : noseh_link_args, diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/analytics/analytics.h b/subprojects/gst-plugins-bad/gst-libs/gst/analytics/analytics.h index d25cf3ba35..cf31f73cd2 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/analytics/analytics.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/analytics/analytics.h @@ -30,5 +30,6 @@ #include #include #include +#include #endif /* __ANALYTICS_H__ */ diff --git a/subprojects/gst-plugins-bad/ext/onnx/tensor/gsttensormeta.c b/subprojects/gst-plugins-bad/gst-libs/gst/analytics/gsttensormeta.c similarity index 100% rename from subprojects/gst-plugins-bad/ext/onnx/tensor/gsttensormeta.c rename to subprojects/gst-plugins-bad/gst-libs/gst/analytics/gsttensormeta.c diff --git a/subprojects/gst-plugins-bad/ext/onnx/tensor/gsttensormeta.h b/subprojects/gst-plugins-bad/gst-libs/gst/analytics/gsttensormeta.h similarity index 94% rename from subprojects/gst-plugins-bad/ext/onnx/tensor/gsttensormeta.h rename to subprojects/gst-plugins-bad/gst-libs/gst/analytics/gsttensormeta.h index d7911312d2..a7bf94f736 100644 --- a/subprojects/gst-plugins-bad/ext/onnx/tensor/gsttensormeta.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/analytics/gsttensormeta.h @@ -19,10 +19,17 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #ifndef __GST_TENSOR_META_H__ #define __GST_TENSOR_META_H__ #include +#include +#include /** * GstTensorDataType: @@ -114,9 +121,13 @@ G_BEGIN_DECLS #define GST_TENSOR_META_INFO \ (gst_tensor_meta_get_info()) - +GST_ANALYTICS_META_API GType gst_tensor_meta_api_get_type (void); + +GST_ANALYTICS_META_API const GstMetaInfo *gst_tensor_meta_get_info (void); + +GST_ANALYTICS_META_API gint gst_tensor_meta_get_index_from_id(GstTensorMeta *meta, GQuark id); G_END_DECLS diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/analytics/meson.build b/subprojects/gst-plugins-bad/gst-libs/gst/analytics/meson.build index a2886e28f7..e745f506a3 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/analytics/meson.build +++ b/subprojects/gst-plugins-bad/gst-libs/gst/analytics/meson.build @@ -1,14 +1,17 @@ analytics_sources = files( 'gstanalyticsmeta.c', 'gstanalyticsclassificationmtd.c', 'gstanalyticsobjectdetectionmtd.c', - 'gstanalyticsobjecttrackingmtd.c') + 'gstanalyticsobjecttrackingmtd.c', + 'gsttensormeta.c') analytics_headers = files( 'analytics.h', 'gstanalyticsmeta.h', 'analytics-meta-prelude.h', 'gstanalyticsclassificationmtd.h', 'gstanalyticsobjectdetectionmtd.h', - 'gstanalyticsobjecttrackingmtd.h') + 'gstanalyticsobjecttrackingmtd.h', + 'gsttensormeta.h', + 'gsttensor.h') install_headers(analytics_headers, subdir : 'gstreamer-1.0/gst/analytics') pkg_name = 'gstreamer-analytics-1.0'