From 03fd6fadbcae8b804036d41a1f9ba7f2b650d35a 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 Part-of: --- .../ext/onnx/decoders/gstssdobjectdetector.c | 1 - subprojects/gst-plugins-bad/ext/onnx/gstonnx.c | 1 - subprojects/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 | 12 +++++++++++- .../gst-libs/gst/analytics/meson.build | 7 ++++--- 8 files changed, 17 insertions(+), 8 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 (95%) diff --git a/subprojects/gst-plugins-bad/ext/onnx/decoders/gstssdobjectdetector.c b/subprojects/gst-plugins-bad/ext/onnx/decoders/gstssdobjectdetector.c index 95009785cd..fd9c0770e6 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 5ae6143515..876f4baa6f 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/analytics/analytics.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/analytics/analytics.h @@ -31,5 +31,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 95% 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..0630cf5bfe 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,16 @@ * 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 /** * GstTensorDataType: @@ -114,9 +120,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 053b0b2234..81d7c2ce66 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/analytics/meson.build +++ b/subprojects/gst-plugins-bad/gst-libs/gst/analytics/meson.build @@ -2,7 +2,8 @@ analytics_sources = files( 'gstanalyticsmeta.c', 'gstanalyticsclassificationmtd.c', 'gstanalyticsobjectdetectionmtd.c', 'gstanalyticsobjecttrackingmtd.c', - 'gstanalyticssegmentationmtd.c') + 'gstanalyticssegmentationmtd.c', + 'gsttensormeta.c') analytics_headers = files( 'analytics.h', 'gstanalyticsmeta.h', @@ -10,8 +11,8 @@ analytics_headers = files( 'analytics.h', 'gstanalyticsclassificationmtd.h', 'gstanalyticsobjectdetectionmtd.h', 'gstanalyticsobjecttrackingmtd.h', - 'gstanalyticssegmentationmtd.h') - + 'gstanalyticssegmentationmtd.h', + 'gsttensormeta.h') install_headers(analytics_headers, subdir : 'gstreamer-1.0/gst/analytics') pkg_name = 'gstreamer-analytics-1.0'