From d529ecf80066eb1414b017455661666324b1a09e Mon Sep 17 00:00:00 2001 From: Melissa Montero Date: Thu, 4 Jun 2020 15:16:33 -0600 Subject: [PATCH 01/12] gstinferencebackend: register backend objects dinamically --- gst-libs/gst/r2inference/gstbackendsubclass.h | 2 + .../gst/r2inference/gstinferencebackend.cc | 98 +++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 gst-libs/gst/r2inference/gstinferencebackend.cc diff --git a/gst-libs/gst/r2inference/gstbackendsubclass.h b/gst-libs/gst/r2inference/gstbackendsubclass.h index 8cef2dac..19ceff93 100644 --- a/gst-libs/gst/r2inference/gstbackendsubclass.h +++ b/gst-libs/gst/r2inference/gstbackendsubclass.h @@ -37,5 +37,7 @@ void gst_backend_install_properties (GstBackendClass * klass, gboolean gst_backend_set_framework_code (GstBackend * backend, r2i::FrameworkCode code); +gboolean gst_inference_backend_register (const gchar* type_name, r2i::FrameworkCode code); + G_END_DECLS #endif //__GST_BACKENDSUBCLASS_H__ diff --git a/gst-libs/gst/r2inference/gstinferencebackend.cc b/gst-libs/gst/r2inference/gstinferencebackend.cc new file mode 100644 index 00000000..3a6ae67d --- /dev/null +++ b/gst-libs/gst/r2inference/gstinferencebackend.cc @@ -0,0 +1,98 @@ +/* + * GStreamer + * Copyright (C) 2018-2020 RidgeRun + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#include "gstbackend.h" +#include "gstbackendsubclass.h" + +#include +#include + +typedef struct _GstInferenceBackend GstInferenceBackend; +struct _GstInferenceBackend +{ + GstBackend parent; +}; + +typedef struct _GstInferenceBackendClass GstInferenceBackendClass; +struct _GstInferenceBackendClass +{ + GstBackendClass parent_class; + r2i::FrameworkCode code; +}; + +#define GST_BACKEND_CODE_QDATA g_quark_from_static_string("backend-code") + +static GstBackendClass *parent_class = NULL; + +static void +gst_inference_backend_class_init (GstInferenceBackendClass * klass) +{ + GstBackendClass *bclass = GST_BACKEND_CLASS (klass); + GObjectClass *oclass = G_OBJECT_CLASS (klass); + + guint code; + parent_class = GST_BACKEND_CLASS (g_type_class_peek_parent (klass)); + + code = + GPOINTER_TO_UINT (g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), + GST_BACKEND_CODE_QDATA)); + + klass->code = (r2i::FrameworkCode) code; + oclass->set_property = gst_backend_set_property; + oclass->get_property = gst_backend_get_property; + gst_backend_install_properties (bclass, klass->code); +} + +static void +gst_inference_backend_init (GstInferenceBackend * self) +{ + GstInferenceBackendClass *klass = + (GstInferenceBackendClass *) G_OBJECT_GET_CLASS (self); + gst_backend_set_framework_code (GST_BACKEND (self), klass->code); +} + +gboolean +gst_inference_backend_register (const gchar * type_name, + r2i::FrameworkCode code) +{ + GTypeInfo typeinfo = { + sizeof (GstInferenceBackendClass), + NULL, + NULL, + (GClassInitFunc) gst_inference_backend_class_init, + NULL, + NULL, + sizeof (GstInferenceBackend), + 0, + (GInstanceInitFunc) gst_inference_backend_init, + }; + GType type; + + type = g_type_from_name (type_name); + if (!type) { + type = g_type_register_static (GST_TYPE_BACKEND, + type_name, &typeinfo, (GTypeFlags) 0); + + g_type_set_qdata (type, GST_BACKEND_CODE_QDATA, GUINT_TO_POINTER (code)); + } + + return TRUE; +} From ec1c995c2390c8f95418954d9b50b741e7b221b4 Mon Sep 17 00:00:00 2001 From: Melissa Montero Date: Thu, 4 Jun 2020 15:21:36 -0600 Subject: [PATCH 02/12] gstinferencebackends: register backends and use the new types --- .../gst/r2inference/gstinferencebackends.cc | 57 ++++++++++++------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/gst-libs/gst/r2inference/gstinferencebackends.cc b/gst-libs/gst/r2inference/gstinferencebackends.cc index 33d3f664..27c1b9b1 100644 --- a/gst-libs/gst/r2inference/gstinferencebackends.cc +++ b/gst-libs/gst/r2inference/gstinferencebackends.cc @@ -19,14 +19,11 @@ * */ -#include "gstinferencebackends.h" -#include "gstchildinspector.h" -#include "gstedgetpu.h" -#include "gstncsdk.h" -#include "gsttensorflow.h" -#include "gsttflite.h" -#include "gsttensorrt.h" #include "gstbackend.h" +#include "gstbackendsubclass.h" +#include "gstchildinspector.h" +#include "gstinferencebackends.h" + #include #include #include @@ -43,10 +40,12 @@ backend_types ({ {r2i::FrameworkCode::MAX_FRAMEWORK, G_TYPE_INVALID} }); +const gchar *gst_inference_backends_search_type_name (guint id); + static void gst_inference_backends_add_frameworkmeta (r2i::FrameworkMeta meta, - gchar ** backends_parameters, r2i::RuntimeError error, - guint alignment); + gchar ** backends_parameters, r2i::RuntimeError error, guint alignment); + GType gst_inference_backends_get_type (void) @@ -57,7 +56,7 @@ gst_inference_backends_get_type (void) {r2i::FrameworkCode::EDGETPU, "TensorFlow Lite with EdgeTPU support", "edgetpu"}, {r2i::FrameworkCode::NCSDK, "Intel Movidius Neural Compute SDK", "ncsdk"}, {r2i::FrameworkCode::TENSORFLOW, "TensorFlow Machine Learning Framework", - "tensorflow"}, + "tensorflow"}, {r2i::FrameworkCode::TFLITE, "Tensorflow Lite Machine Learning Framework", "tflite"}, {r2i::FrameworkCode::TENSORRT, "NVIDIA's TensorRT Framework", @@ -72,8 +71,9 @@ gst_inference_backends_get_type (void) return backend_type; } -GType -gst_inference_backends_search_type (guint id) + +const gchar * +gst_inference_backends_search_type_name (guint id) { auto search = backend_types.find (id); if (backend_types.end () == search) { @@ -82,23 +82,42 @@ gst_inference_backends_search_type (guint id) return search->second; } + +GType +gst_inference_backends_search_type (guint id) +{ + const gchar *backend_type_name; + GType backend_type; + + backend_type_name = gst_inference_backends_search_type_name (id); + + if (!backend_type_name) { + backend_type = G_TYPE_INVALID; + } else { + backend_type = g_type_from_name (backend_type_name); + } + + return backend_type; +} + static void gst_inference_backends_add_frameworkmeta (r2i::FrameworkMeta meta, - gchar ** backends_parameters, r2i::RuntimeError error, - guint alignment) + gchar ** backends_parameters, r2i::RuntimeError error, guint alignment) { - GstBackend * backend = NULL; - gchar * parameters, * backend_name; + GstBackend *backend = NULL; + gchar *parameters, *backend_name; + const gchar *backend_type_name; GType backend_type; - backend_type = gst_inference_backends_search_type (meta.code); - - if (G_TYPE_INVALID == backend_type) { + backend_type_name = gst_inference_backends_search_type_name (meta.code); + if (NULL == backend_type_name) { GST_ERROR_OBJECT (backend, "Failed to find Backend type: %s", meta.name.c_str ()); return; } + gst_inference_backend_register (backend_type_name, meta.code); + backend_type = g_type_from_name (backend_type_name); backend = (GstBackend *) g_object_new (backend_type, NULL); backend_name = From 95a9c07edb50ee7db87916331a183f303b7d0684 Mon Sep 17 00:00:00 2001 From: Melissa Montero Date: Thu, 4 Jun 2020 15:26:14 -0600 Subject: [PATCH 03/12] Remove backends files, no longer needed --- gst-libs/gst/r2inference/Makefile.am | 13 +----- gst-libs/gst/r2inference/gstedgetpu.cc | 54 ---------------------- gst-libs/gst/r2inference/gstedgetpu.h | 35 --------------- gst-libs/gst/r2inference/gstncsdk.cc | 55 ----------------------- gst-libs/gst/r2inference/gstncsdk.h | 35 --------------- gst-libs/gst/r2inference/gsttensorflow.cc | 54 ---------------------- gst-libs/gst/r2inference/gsttensorflow.h | 35 --------------- gst-libs/gst/r2inference/gsttensorrt.cc | 54 ---------------------- gst-libs/gst/r2inference/gsttensorrt.h | 35 --------------- gst-libs/gst/r2inference/gsttflite.cc | 54 ---------------------- gst-libs/gst/r2inference/gsttflite.h | 35 --------------- gst-libs/gst/r2inference/meson.build | 11 +---- 12 files changed, 3 insertions(+), 467 deletions(-) delete mode 100644 gst-libs/gst/r2inference/gstedgetpu.cc delete mode 100644 gst-libs/gst/r2inference/gstedgetpu.h delete mode 100644 gst-libs/gst/r2inference/gstncsdk.cc delete mode 100644 gst-libs/gst/r2inference/gstncsdk.h delete mode 100644 gst-libs/gst/r2inference/gsttensorflow.cc delete mode 100644 gst-libs/gst/r2inference/gsttensorflow.h delete mode 100644 gst-libs/gst/r2inference/gsttensorrt.cc delete mode 100644 gst-libs/gst/r2inference/gsttensorrt.h delete mode 100644 gst-libs/gst/r2inference/gsttflite.cc delete mode 100644 gst-libs/gst/r2inference/gsttflite.h diff --git a/gst-libs/gst/r2inference/Makefile.am b/gst-libs/gst/r2inference/Makefile.am index 846404c9..ea419bee 100644 --- a/gst-libs/gst/r2inference/Makefile.am +++ b/gst-libs/gst/r2inference/Makefile.am @@ -7,16 +7,12 @@ libgstinference_@GST_API_VERSION@_la_SOURCES= \ gstinferencemeta.c \ gstinferencebackends.cc \ gstbackend.cc \ - gstedgetpu.cc \ - gstncsdk.cc \ - gsttensorflow.cc \ - gsttflite.cc \ - gsttensorrt.cc \ gstinferencepreprocess.c \ gstinferencepostprocess.c \ gstinferencedebug.c \ gstinferenceprediction.c \ - gstinferenceclassification.c + gstinferenceclassification.c \ + gstinferencebackend.cc libgstinference_@GST_API_VERSION@_la_CXXFLAGS= \ $(GST_CXXFLAGS) \ @@ -46,11 +42,6 @@ gstinferenceinclude_HEADERS= \ gstinferencebackends.h \ gstbackend.h \ gstbackendsubclass.h \ - gstedgetpu.h \ - gstncsdk.h \ - gsttensorflow.h \ - gsttflite.h \ - gsttensorrt.h \ gstinferencepreprocess.h \ gstinferencepostprocess.h \ gstinferencedebug.h \ diff --git a/gst-libs/gst/r2inference/gstedgetpu.cc b/gst-libs/gst/r2inference/gstedgetpu.cc deleted file mode 100644 index 855e32b1..00000000 --- a/gst-libs/gst/r2inference/gstedgetpu.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2020 RidgeRun - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#include "gstedgetpu.h" - -#include - -GST_DEBUG_CATEGORY_STATIC (gst_edgetpu_debug_category); -#define GST_CAT_DEFAULT gst_edgetpu_debug_category - -struct _GstEdgeTPU -{ - GstBackend parent; -}; - -G_DEFINE_TYPE_WITH_CODE (GstEdgeTPU, gst_edgetpu, GST_TYPE_BACKEND, - GST_DEBUG_CATEGORY_INIT (gst_edgetpu_debug_category, "edgetpu", 0, - "debug category for edgetpu parameters")); - -static void -gst_edgetpu_class_init (GstEdgeTPUClass * klass) -{ - GstBackendClass *bclass = GST_BACKEND_CLASS (klass); - GObjectClass *oclass = G_OBJECT_CLASS (klass); - - oclass->set_property = gst_backend_set_property; - oclass->get_property = gst_backend_get_property; - gst_backend_install_properties (bclass, r2i::FrameworkCode::EDGETPU); -} - -static void -gst_edgetpu_init (GstEdgeTPU * self) -{ - gst_backend_set_framework_code (GST_BACKEND (self), - r2i::FrameworkCode::EDGETPU); -} diff --git a/gst-libs/gst/r2inference/gstedgetpu.h b/gst-libs/gst/r2inference/gstedgetpu.h deleted file mode 100644 index c8575ce1..00000000 --- a/gst-libs/gst/r2inference/gstedgetpu.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2020 RidgeRun - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#ifndef __GST_EDGETPU_H__ -#define __GST_EDGETPU_H__ - -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_EDGETPU gst_edgetpu_get_type () -G_DECLARE_FINAL_TYPE(GstEdgeTPU, gst_edgetpu, GST, EDGETPU, GstBackend); - -G_END_DECLS - -#endif //__GST_EDGETPU_H__ diff --git a/gst-libs/gst/r2inference/gstncsdk.cc b/gst-libs/gst/r2inference/gstncsdk.cc deleted file mode 100644 index cc2eff89..00000000 --- a/gst-libs/gst/r2inference/gstncsdk.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2018-2020 RidgeRun - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#include "gstncsdk.h" - -#include - -GST_DEBUG_CATEGORY_STATIC (gst_ncsdk_debug_category); -#define GST_CAT_DEFAULT gst_ncsdk_debug_category - -struct _GstNcsdk -{ - GstBackend parent; -}; - -G_DEFINE_TYPE_WITH_CODE (GstNcsdk, gst_ncsdk, GST_TYPE_BACKEND, - GST_DEBUG_CATEGORY_INIT (gst_ncsdk_debug_category, "ncsdk", 0, - "debug category for ncsdk parameters")); - -static void -gst_ncsdk_class_init (GstNcsdkClass * klass) -{ - GstBackendClass *bclass = GST_BACKEND_CLASS (klass); - GObjectClass *oclass = G_OBJECT_CLASS (klass); - - oclass->set_property = gst_backend_set_property; - oclass->get_property = gst_backend_get_property; - - gst_backend_install_properties (bclass, r2i::FrameworkCode::NCSDK); -} - -static void -gst_ncsdk_init (GstNcsdk * self) -{ - gst_backend_set_framework_code (GST_BACKEND (self), - r2i::FrameworkCode::NCSDK); -} diff --git a/gst-libs/gst/r2inference/gstncsdk.h b/gst-libs/gst/r2inference/gstncsdk.h deleted file mode 100644 index 17b0ff02..00000000 --- a/gst-libs/gst/r2inference/gstncsdk.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2018-2020 RidgeRun - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#ifndef __GST_NCSDK_H__ -#define __GST_NCSDK_H__ - -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_NCSDK gst_ncsdk_get_type () -G_DECLARE_FINAL_TYPE(GstNcsdk, gst_ncsdk, GST, NCSDK, GstBackend); - -G_END_DECLS - -#endif //__GST_NCSDK_H__ diff --git a/gst-libs/gst/r2inference/gsttensorflow.cc b/gst-libs/gst/r2inference/gsttensorflow.cc deleted file mode 100644 index f00eeeb6..00000000 --- a/gst-libs/gst/r2inference/gsttensorflow.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2018-2020 RidgeRun - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#include "gsttensorflow.h" - -#include - -GST_DEBUG_CATEGORY_STATIC (gst_tensorflow_debug_category); -#define GST_CAT_DEFAULT gst_tensorflow_debug_category - -struct _GstTensorflow -{ - GstBackend parent; -}; - -G_DEFINE_TYPE_WITH_CODE (GstTensorflow, gst_tensorflow, GST_TYPE_BACKEND, - GST_DEBUG_CATEGORY_INIT (gst_tensorflow_debug_category, "tensorflow", 0, - "debug category for tensorflow parameters")); - -static void -gst_tensorflow_class_init (GstTensorflowClass * klass) -{ - GstBackendClass *bclass = GST_BACKEND_CLASS (klass); - GObjectClass *oclass = G_OBJECT_CLASS (klass); - - oclass->set_property = gst_backend_set_property; - oclass->get_property = gst_backend_get_property; - gst_backend_install_properties (bclass, r2i::FrameworkCode::TENSORFLOW); -} - -static void -gst_tensorflow_init (GstTensorflow * self) -{ - gst_backend_set_framework_code (GST_BACKEND (self), - r2i::FrameworkCode::TENSORFLOW); -} diff --git a/gst-libs/gst/r2inference/gsttensorflow.h b/gst-libs/gst/r2inference/gsttensorflow.h deleted file mode 100644 index a8594457..00000000 --- a/gst-libs/gst/r2inference/gsttensorflow.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2018-2020 RidgeRun - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#ifndef __GST_TENSORFLOW_H__ -#define __GST_TENSORFLOW_H__ - -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_TENSORFLOW gst_tensorflow_get_type () -G_DECLARE_FINAL_TYPE(GstTensorflow, gst_tensorflow, GST, TENSORFLOW, GstBackend); - -G_END_DECLS - -#endif //__GST_TENSORFLOW_H__ diff --git a/gst-libs/gst/r2inference/gsttensorrt.cc b/gst-libs/gst/r2inference/gsttensorrt.cc deleted file mode 100644 index 9616f724..00000000 --- a/gst-libs/gst/r2inference/gsttensorrt.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2018-2020 RidgeRun - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#include "gsttensorrt.h" - -#include - -GST_DEBUG_CATEGORY_STATIC (gst_tensorrt_debug_category); -#define GST_CAT_DEFAULT gst_tensorrt_debug_category - -struct _GstTensorrt -{ - GstBackend parent; -}; - -G_DEFINE_TYPE_WITH_CODE (GstTensorrt, gst_tensorrt, GST_TYPE_BACKEND, - GST_DEBUG_CATEGORY_INIT (gst_tensorrt_debug_category, "tensorrt", 0, - "debug category for tensorrt parameters")); - -static void -gst_tensorrt_class_init (GstTensorrtClass * klass) -{ - GstBackendClass *bclass = GST_BACKEND_CLASS (klass); - GObjectClass *oclass = G_OBJECT_CLASS (klass); - - oclass->set_property = gst_backend_set_property; - oclass->get_property = gst_backend_get_property; - gst_backend_install_properties (bclass, r2i::FrameworkCode::TENSORRT); -} - -static void -gst_tensorrt_init (GstTensorrt * self) -{ - gst_backend_set_framework_code (GST_BACKEND (self), - r2i::FrameworkCode::TENSORRT); -} diff --git a/gst-libs/gst/r2inference/gsttensorrt.h b/gst-libs/gst/r2inference/gsttensorrt.h deleted file mode 100644 index ce523182..00000000 --- a/gst-libs/gst/r2inference/gsttensorrt.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2018-2020 RidgeRun - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#ifndef __GST_TENSORRT_H__ -#define __GST_TENSORRT_H__ - -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_TENSORRT gst_tensorrt_get_type () -G_DECLARE_FINAL_TYPE(GstTensorrt, gst_tensorrt, GST, TENSORRT, GstBackend); - -G_END_DECLS - -#endif //__GST_TENSORRT_H__ diff --git a/gst-libs/gst/r2inference/gsttflite.cc b/gst-libs/gst/r2inference/gsttflite.cc deleted file mode 100644 index d2286ac0..00000000 --- a/gst-libs/gst/r2inference/gsttflite.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2018-2020 RidgeRun - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#include "gsttflite.h" - -#include - -GST_DEBUG_CATEGORY_STATIC (gst_tflite_debug_category); -#define GST_CAT_DEFAULT gst_tflite_debug_category - -struct _GstTflite -{ - GstBackend parent; -}; - -G_DEFINE_TYPE_WITH_CODE (GstTflite, gst_tflite, GST_TYPE_BACKEND, - GST_DEBUG_CATEGORY_INIT (gst_tflite_debug_category, "tflite", 0, - "debug category for tflite parameters")); - -static void -gst_tflite_class_init (GstTfliteClass * klass) -{ - GstBackendClass *bclass = GST_BACKEND_CLASS (klass); - GObjectClass *oclass = G_OBJECT_CLASS (klass); - - oclass->set_property = gst_backend_set_property; - oclass->get_property = gst_backend_get_property; - gst_backend_install_properties (bclass, r2i::FrameworkCode::TFLITE); -} - -static void -gst_tflite_init (GstTflite * self) -{ - gst_backend_set_framework_code (GST_BACKEND (self), - r2i::FrameworkCode::TFLITE); -} diff --git a/gst-libs/gst/r2inference/gsttflite.h b/gst-libs/gst/r2inference/gsttflite.h deleted file mode 100644 index 0260114f..00000000 --- a/gst-libs/gst/r2inference/gsttflite.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2018-2020 RidgeRun - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#ifndef __GST_TFLITE_H__ -#define __GST_TFLITE_H__ - -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_TFLITE gst_tflite_get_type () -G_DECLARE_FINAL_TYPE(GstTflite, gst_tflite, GST, TFLITE, GstBackend); - -G_END_DECLS - -#endif //__GST_TFLITE_H__ diff --git a/gst-libs/gst/r2inference/meson.build b/gst-libs/gst/r2inference/meson.build index 385e4382..e6c5350c 100644 --- a/gst-libs/gst/r2inference/meson.build +++ b/gst-libs/gst/r2inference/meson.build @@ -1,6 +1,7 @@ gstinference_sources = [ 'gstbackend.cc', 'gstchildinspector.c', + 'gstinferencebackend.cc', 'gstinferencebackends.cc', 'gstinferencedebug.c', 'gstinferenceclassification.c', @@ -8,11 +9,6 @@ gstinference_sources = [ 'gstinferenceprediction.c', 'gstinferencepostprocess.c', 'gstinferencepreprocess.c', - 'gstedgetpu.cc', - 'gstncsdk.cc', - 'gsttensorflow.cc', - 'gsttflite.cc', - 'gsttensorrt.cc', 'gstvideoinference.c' ] @@ -27,11 +23,6 @@ gstinference_headers = [ 'gstinferencepreprocess.h', 'gstinferenceclassification.h', 'gstinferenceprediction.h', - 'gstedgetpu.h', - 'gstncsdk.h', - 'gsttensorflow.h', - 'gsttflite.h', - 'gsttensorrt.h', 'gstvideoinference.h' ] From e932ebc7331d57241708f405a03ad1ff0f232697 Mon Sep 17 00:00:00 2001 From: Melissa Montero Date: Thu, 18 Jun 2020 14:40:34 -0600 Subject: [PATCH 04/12] gstinferencebackends: create backends enum dinamically --- .../gst/r2inference/gstinferencebackends.cc | 49 +++++++++++++------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/gst-libs/gst/r2inference/gstinferencebackends.cc b/gst-libs/gst/r2inference/gstinferencebackends.cc index 27c1b9b1..89972ee4 100644 --- a/gst-libs/gst/r2inference/gstinferencebackends.cc +++ b/gst-libs/gst/r2inference/gstinferencebackends.cc @@ -46,31 +46,48 @@ static void gst_inference_backends_add_frameworkmeta (r2i::FrameworkMeta meta, gchar ** backends_parameters, r2i::RuntimeError error, guint alignment); +static void +gst_inference_backends_enum_register_item (const guint id, + const gchar * desc, const gchar * shortname); + +static GEnumValue *backend_enum_desc = NULL; GType gst_inference_backends_get_type (void) { static GType backend_type = 0; - static const GEnumValue - backend_desc[] = { - {r2i::FrameworkCode::EDGETPU, "TensorFlow Lite with EdgeTPU support", "edgetpu"}, - {r2i::FrameworkCode::NCSDK, "Intel Movidius Neural Compute SDK", "ncsdk"}, - {r2i::FrameworkCode::TENSORFLOW, "TensorFlow Machine Learning Framework", - "tensorflow"}, - {r2i::FrameworkCode::TFLITE, "Tensorflow Lite Machine Learning Framework", - "tflite"}, - {r2i::FrameworkCode::TENSORRT, "NVIDIA's TensorRT Framework", - "tensorrt"}, - {0, NULL, NULL} - }; if (!backend_type) { backend_type = g_enum_register_static ("GstInferenceBackends", - (GEnumValue *) backend_desc); + (GEnumValue *) backend_enum_desc); } return backend_type; } +static void +gst_inference_backends_enum_register_item (const guint id, + const gchar * desc, const gchar * shortname) +{ + static guint backend_enum_count = 0; + GEnumValue *backend_desc; + + backend_enum_desc = + (GEnumValue *) g_realloc_n (backend_enum_desc, backend_enum_count + 2, + sizeof (GEnumValue)); + + backend_desc = &backend_enum_desc[backend_enum_count]; + backend_desc->value = id; + backend_desc->value_name = g_strdup (desc); + backend_desc->value_nick = g_strdup (shortname); + + backend_enum_count++; + + /* Sentinel */ + backend_desc = &backend_enum_desc[backend_enum_count]; + backend_desc->value = 0; + backend_desc->value_name = NULL; + backend_desc->value_nick = NULL; +} const gchar * gst_inference_backends_search_type_name (guint id) @@ -109,13 +126,15 @@ gst_inference_backends_add_frameworkmeta (r2i::FrameworkMeta meta, const gchar *backend_type_name; GType backend_type; - backend_type_name = gst_inference_backends_search_type_name (meta.code); + gst_inference_backends_enum_register_item (meta.code, + meta.description.c_str (), meta.name.c_str ()); + + backend_type_name = g_strdup_printf ("Gst%s", meta.name.c_str ()); if (NULL == backend_type_name) { GST_ERROR_OBJECT (backend, "Failed to find Backend type: %s", meta.name.c_str ()); return; } - gst_inference_backend_register (backend_type_name, meta.code); backend_type = g_type_from_name (backend_type_name); backend = (GstBackend *) g_object_new (backend_type, NULL); From 905fe009bde38db4516f054f2ceba6cf38cc07d9 Mon Sep 17 00:00:00 2001 From: Melissa Montero Date: Thu, 18 Jun 2020 20:04:20 -0600 Subject: [PATCH 05/12] gstinferencebackends: use r2i framework's name to get the backend object --- .../gst/r2inference/gstinferencebackends.cc | 52 ++++++++----------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/gst-libs/gst/r2inference/gstinferencebackends.cc b/gst-libs/gst/r2inference/gstinferencebackends.cc index 89972ee4..2e5e0bd4 100644 --- a/gst-libs/gst/r2inference/gstinferencebackends.cc +++ b/gst-libs/gst/r2inference/gstinferencebackends.cc @@ -30,18 +30,6 @@ #define DEFAULT_ALIGNMENT 32 -static std::unordered_map -backend_types ({ - {r2i::FrameworkCode::EDGETPU, GST_TYPE_EDGETPU}, - {r2i::FrameworkCode::NCSDK, GST_TYPE_NCSDK}, - {r2i::FrameworkCode::TENSORFLOW, GST_TYPE_TENSORFLOW}, - {r2i::FrameworkCode::TFLITE, GST_TYPE_TFLITE}, - {r2i::FrameworkCode::TENSORRT, GST_TYPE_TENSORRT}, - {r2i::FrameworkCode::MAX_FRAMEWORK, G_TYPE_INVALID} -}); - -const gchar *gst_inference_backends_search_type_name (guint id); - static void gst_inference_backends_add_frameworkmeta (r2i::FrameworkMeta meta, gchar ** backends_parameters, r2i::RuntimeError error, guint alignment); @@ -50,6 +38,8 @@ static void gst_inference_backends_enum_register_item (const guint id, const gchar * desc, const gchar * shortname); +static gchar *gst_inference_backends_get_type_name (const gchar * framework); + static GEnumValue *backend_enum_desc = NULL; GType @@ -89,31 +79,34 @@ gst_inference_backends_enum_register_item (const guint id, backend_desc->value_nick = NULL; } -const gchar * -gst_inference_backends_search_type_name (guint id) +static gchar * +gst_inference_backends_get_type_name (const gchar * framework) { - auto search = backend_types.find (id); - if (backend_types.end () == search) { - search = backend_types.find (r2i::FrameworkCode::MAX_FRAMEWORK); - } - return search->second; + return g_strdup_printf ("Gst%s", framework); } GType gst_inference_backends_search_type (guint id) { - const gchar *backend_type_name; - GType backend_type; - - backend_type_name = gst_inference_backends_search_type_name (id); - - if (!backend_type_name) { - backend_type = G_TYPE_INVALID; - } else { + const gchar *framework = NULL; + gchar *backend_type_name = NULL; + GType backend_type = G_TYPE_INVALID; + GEnumClass *enum_class = NULL; + GEnumValue *enum_value = NULL; + + enum_class = (GEnumClass *) g_type_class_ref (GST_TYPE_INFERENCE_BACKENDS); + enum_value = g_enum_get_value (enum_class, id); + + if (enum_value) { + framework = enum_value->value_nick; + backend_type_name = gst_inference_backends_get_type_name (framework); backend_type = g_type_from_name (backend_type_name); + g_free (backend_type_name); } + g_type_class_unref (enum_class); + return backend_type; } @@ -123,13 +116,13 @@ gst_inference_backends_add_frameworkmeta (r2i::FrameworkMeta meta, { GstBackend *backend = NULL; gchar *parameters, *backend_name; - const gchar *backend_type_name; + gchar *backend_type_name; GType backend_type; gst_inference_backends_enum_register_item (meta.code, meta.description.c_str (), meta.name.c_str ()); - backend_type_name = g_strdup_printf ("Gst%s", meta.name.c_str ()); + backend_type_name = gst_inference_backends_get_type_name (meta.name.c_str ()); if (NULL == backend_type_name) { GST_ERROR_OBJECT (backend, "Failed to find Backend type: %s", meta.name.c_str ()); @@ -138,6 +131,7 @@ gst_inference_backends_add_frameworkmeta (r2i::FrameworkMeta meta, gst_inference_backend_register (backend_type_name, meta.code); backend_type = g_type_from_name (backend_type_name); backend = (GstBackend *) g_object_new (backend_type, NULL); + g_free (backend_type_name); backend_name = g_strdup_printf ("%*s: %s. Version: %s\n", alignment, meta.name.c_str (), From 0a8d504dae23610dc285af338b3980786c326194 Mon Sep 17 00:00:00 2001 From: Melissa Montero Date: Thu, 18 Jun 2020 20:16:49 -0600 Subject: [PATCH 06/12] Change GstBackend to GstBaseBackend This will change the backend class name to be GstBaseBackend that reflects more properly is functionality. This is a base class for the different backends types. --- gst-libs/gst/r2inference/Makefile.am | 6 +- .../{gstbackend.cc => gstbasebackend.cc} | 110 +++++++++--------- .../{gstbackend.h => gstbasebackend.h} | 22 ++-- ...endsubclass.h => gstbasebackendsubclass.h} | 16 +-- .../gst/r2inference/gstinferencebackend.cc | 24 ++-- .../gst/r2inference/gstinferencebackends.cc | 8 +- gst-libs/gst/r2inference/gstvideoinference.c | 16 +-- gst-libs/gst/r2inference/meson.build | 6 +- 8 files changed, 104 insertions(+), 104 deletions(-) rename gst-libs/gst/r2inference/{gstbackend.cc => gstbasebackend.cc} (79%) rename gst-libs/gst/r2inference/{gstbackend.h => gstbasebackend.h} (63%) rename gst-libs/gst/r2inference/{gstbackendsubclass.h => gstbasebackendsubclass.h} (73%) diff --git a/gst-libs/gst/r2inference/Makefile.am b/gst-libs/gst/r2inference/Makefile.am index ea419bee..ce325c3f 100644 --- a/gst-libs/gst/r2inference/Makefile.am +++ b/gst-libs/gst/r2inference/Makefile.am @@ -6,7 +6,7 @@ libgstinference_@GST_API_VERSION@_la_SOURCES= \ gstchildinspector.c \ gstinferencemeta.c \ gstinferencebackends.cc \ - gstbackend.cc \ + gstbasebackend.cc \ gstinferencepreprocess.c \ gstinferencepostprocess.c \ gstinferencedebug.c \ @@ -40,8 +40,8 @@ gstinferenceinclude_HEADERS= \ gstvideoinference.h \ gstchildinspector.h \ gstinferencebackends.h \ - gstbackend.h \ - gstbackendsubclass.h \ + gstbasebackend.h \ + gstbasebackendsubclass.h \ gstinferencepreprocess.h \ gstinferencepostprocess.h \ gstinferencedebug.h \ diff --git a/gst-libs/gst/r2inference/gstbackend.cc b/gst-libs/gst/r2inference/gstbasebackend.cc similarity index 79% rename from gst-libs/gst/r2inference/gstbackend.cc rename to gst-libs/gst/r2inference/gstbasebackend.cc index 6cb9f777..31d75deb 100644 --- a/gst-libs/gst/r2inference/gstbackend.cc +++ b/gst-libs/gst/r2inference/gstbasebackend.cc @@ -19,8 +19,8 @@ * */ -#include "gstbackend.h" -#include "gstbackendsubclass.h" +#include "gstbasebackend.h" +#include "gstbasebackendsubclass.h" #include @@ -28,8 +28,8 @@ #include #include -GST_DEBUG_CATEGORY_STATIC (gst_backend_debug_category); -#define GST_CAT_DEFAULT gst_backend_debug_category +GST_DEBUG_CATEGORY_STATIC (gst_base_backend_debug_category); +#define GST_CAT_DEFAULT gst_base_backend_debug_category #define DOUBLE_PROPERTY_DEFAULT_VALUE 0.0 @@ -58,7 +58,7 @@ class InferenceProperty { g_free(avalue); } - void apply_inference_property(GstBackend *self, + void apply_inference_property(GstBaseBackend *self, std::shared_ptr params, r2i::RuntimeError &error) { switch (apspec->value_type) { case G_TYPE_STRING: @@ -87,8 +87,8 @@ class InferenceProperty { } }; -typedef struct _GstBackendPrivate GstBackendPrivate; -struct _GstBackendPrivate { +typedef struct _GstBaseBackendPrivate GstBaseBackendPrivate; +struct _GstBaseBackendPrivate { r2i::FrameworkCode code; std::shared_ptr < r2i::IEngine > engine; std::shared_ptr < r2i::ILoader > loader; @@ -102,32 +102,32 @@ struct _GstBackendPrivate { }; -G_DEFINE_TYPE_WITH_CODE (GstBackend, gst_backend, G_TYPE_OBJECT, - GST_DEBUG_CATEGORY_INIT (gst_backend_debug_category, "backend", 0, - "debug category for backend parameters"); G_ADD_PRIVATE (GstBackend)); +G_DEFINE_TYPE_WITH_CODE (GstBaseBackend, gst_base_backend, G_TYPE_OBJECT, + GST_DEBUG_CATEGORY_INIT (gst_base_backend_debug_category, "backend", 0, + "debug category for backend parameters"); G_ADD_PRIVATE (GstBaseBackend)); -#define GST_BACKEND_PRIVATE(self) \ - (GstBackendPrivate *)(gst_backend_get_instance_private (self)) +#define GST_BASE_BACKEND_PRIVATE(self) \ + (GstBaseBackendPrivate *)(gst_base_backend_get_instance_private (self)) -static GParamSpec *gst_backend_param_to_spec (r2i::ParameterMeta *param); -static int gst_backend_param_flags (int flags); -static void gst_backend_finalize (GObject *obj); +static GParamSpec *gst_base_backend_param_to_spec (r2i::ParameterMeta *param); +static int gst_base_backend_param_flags (int flags); +static void gst_base_backend_finalize (GObject *obj); -#define GST_BACKEND_ERROR gst_backend_error_quark() +#define GST_BASE_BACKEND_ERROR gst_base_backend_error_quark() static void -gst_backend_class_init (GstBackendClass *klass) { +gst_base_backend_class_init (GstBaseBackendClass *klass) { GObjectClass *oclass = G_OBJECT_CLASS (klass); - oclass->set_property = gst_backend_set_property; - oclass->get_property = gst_backend_get_property; - oclass->finalize = gst_backend_finalize; + oclass->set_property = gst_base_backend_set_property; + oclass->get_property = gst_base_backend_get_property; + oclass->finalize = gst_base_backend_finalize; } static void -gst_backend_init (GstBackend *self) { - GstBackendPrivate *priv = GST_BACKEND_PRIVATE (self); +gst_base_backend_init (GstBaseBackend *self) { + GstBaseBackendPrivate *priv = GST_BASE_BACKEND_PRIVATE (self); g_mutex_init(&priv->backend_mutex); priv->backend_started = false; priv->backend_created = false; @@ -135,9 +135,9 @@ gst_backend_init (GstBackend *self) { } static void -gst_backend_finalize (GObject *obj) { - GstBackend *self = GST_BACKEND (obj); - GstBackendPrivate *priv = GST_BACKEND_PRIVATE (self); +gst_base_backend_finalize (GObject *obj) { + GstBaseBackend *self = GST_BASE_BACKEND (obj); + GstBaseBackendPrivate *priv = GST_BASE_BACKEND_PRIVATE (self); g_mutex_clear (&priv->backend_mutex); priv->engine = nullptr; @@ -147,11 +147,11 @@ gst_backend_finalize (GObject *obj) { priv->factory = nullptr; priv-> property_list = nullptr; - G_OBJECT_CLASS (gst_backend_parent_class)->finalize (obj); + G_OBJECT_CLASS (gst_base_backend_parent_class)->finalize (obj); } void -gst_backend_install_properties (GstBackendClass *klass, +gst_base_backend_install_properties (GstBaseBackendClass *klass, r2i::FrameworkCode code) { GObjectClass *oclass = G_OBJECT_CLASS (klass); r2i::RuntimeError error; @@ -163,14 +163,14 @@ gst_backend_install_properties (GstBackendClass *klass, error = pfactory->List (params); for (auto ¶m : params) { - GParamSpec *spec = gst_backend_param_to_spec (¶m); + GParamSpec *spec = gst_base_backend_param_to_spec (¶m); g_object_class_install_property (oclass, nprop, spec); nprop++; } } static int -gst_backend_param_flags (int flags) { +gst_base_backend_param_flags (int flags) { int pflags = 0; if (r2i::ParameterMeta::Flags::READ & flags) { @@ -185,7 +185,7 @@ gst_backend_param_flags (int flags) { } static GParamSpec * -gst_backend_param_to_spec (r2i::ParameterMeta *param) { +gst_base_backend_param_to_spec (r2i::ParameterMeta *param) { GParamSpec *spec = NULL; switch (param->type) { @@ -194,14 +194,14 @@ gst_backend_param_to_spec (r2i::ParameterMeta *param) { param->name.c_str (), param->description.c_str (), G_MININT, - G_MAXINT, 0, (GParamFlags) gst_backend_param_flags (param->flags)); + G_MAXINT, 0, (GParamFlags) gst_base_backend_param_flags (param->flags)); break; } case (r2i::ParameterMeta::Type::STRING): { spec = g_param_spec_string (param->name.c_str (), param->name.c_str (), param->description.c_str (), - NULL, (GParamFlags) gst_backend_param_flags (param->flags)); + NULL, (GParamFlags) gst_base_backend_param_flags (param->flags)); break; } case (r2i::ParameterMeta::Type::DOUBLE): { @@ -210,7 +210,7 @@ gst_backend_param_to_spec (r2i::ParameterMeta *param) { param->description.c_str (), -G_MAXDOUBLE, G_MAXDOUBLE, DOUBLE_PROPERTY_DEFAULT_VALUE, - (GParamFlags) gst_backend_param_flags (param->flags)); + (GParamFlags) gst_base_backend_param_flags (param->flags)); break; } default: @@ -220,10 +220,10 @@ gst_backend_param_to_spec (r2i::ParameterMeta *param) { } void -gst_backend_set_property (GObject *object, guint property_id, +gst_base_backend_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - GstBackend *self = GST_BACKEND (object); - GstBackendPrivate *priv = GST_BACKEND_PRIVATE (self); + GstBaseBackend *self = GST_BASE_BACKEND (object); + GstBaseBackendPrivate *priv = GST_BASE_BACKEND_PRIVATE (self); InferenceProperty *property; GST_DEBUG_OBJECT (self, "set_property"); @@ -254,10 +254,10 @@ gst_backend_set_property (GObject *object, guint property_id, } void -gst_backend_get_property (GObject *object, guint property_id, +gst_base_backend_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { - GstBackend *self = GST_BACKEND (object); - GstBackendPrivate *priv = GST_BACKEND_PRIVATE (self); + GstBaseBackend *self = GST_BASE_BACKEND (object); + GstBaseBackendPrivate *priv = GST_BASE_BACKEND_PRIVATE (self); int int_buffer; double double_buffer; std::string string_buffer; @@ -282,9 +282,9 @@ gst_backend_get_property (GObject *object, guint property_id, } gboolean -gst_backend_start (GstBackend *self, const gchar *model_location, +gst_base_backend_start (GstBaseBackend *self, const gchar *model_location, GError **err) { - GstBackendPrivate *priv = GST_BACKEND_PRIVATE (self); + GstBaseBackendPrivate *priv = GST_BASE_BACKEND_PRIVATE (self); r2i::RuntimeError error; InferenceProperty *property; std::list::iterator property_it; @@ -390,15 +390,15 @@ gst_backend_start (GstBackend *self, const gchar *model_location, start_error: g_mutex_unlock (&priv->backend_mutex); error: - g_set_error (err, GST_BACKEND_ERROR, error.GetCode (), + g_set_error (err, GST_BASE_BACKEND_ERROR, error.GetCode (), "R2Inference Error: (Code:%d) %s", error.GetCode (), error.GetDescription ().c_str ()); return FALSE; } gboolean -gst_backend_stop (GstBackend *self, GError **err) { - GstBackendPrivate *priv = GST_BACKEND_PRIVATE (self); +gst_base_backend_stop (GstBaseBackend *self, GError **err) { + GstBaseBackendPrivate *priv = GST_BASE_BACKEND_PRIVATE (self); r2i::RuntimeError error; g_return_val_if_fail (priv, FALSE); @@ -412,14 +412,14 @@ gst_backend_stop (GstBackend *self, GError **err) { return TRUE; error: - g_set_error (err, GST_BACKEND_ERROR, error.GetCode (), + g_set_error (err, GST_BASE_BACKEND_ERROR, error.GetCode (), "R2Inference Error: (Code:%d) %s", error.GetCode (), error.GetDescription ().c_str ()); return FALSE; } static r2i::ImageFormat::Id -gst_backend_cast_format (GstVideoFormat format) { +gst_base_backend_cast_format (GstVideoFormat format) { r2i::ImageFormat::Id image_format; switch (format) { @@ -440,9 +440,9 @@ gst_backend_cast_format (GstVideoFormat format) { } gboolean -gst_backend_process_frame (GstBackend *self, GstVideoFrame *input_frame, +gst_base_backend_process_frame (GstBaseBackend *self, GstVideoFrame *input_frame, gpointer *prediction_data, gsize *prediction_size, GError **err) { - GstBackendPrivate *priv = GST_BACKEND_PRIVATE (self); + GstBaseBackendPrivate *priv = GST_BASE_BACKEND_PRIVATE (self); std::shared_ptr < r2i::IPrediction > prediction; std::shared_ptr < r2i::IFrame > frame; r2i::RuntimeError error; @@ -464,7 +464,7 @@ gst_backend_process_frame (GstBackend *self, GstVideoFrame *input_frame, error = frame->Configure (input_frame->data[0], input_frame->info.width, input_frame->info.height, - gst_backend_cast_format(input_frame->info.finfo->format)); + gst_base_backend_cast_format(input_frame->info.finfo->format)); if (error.IsError ()) { goto error; } @@ -488,15 +488,15 @@ gst_backend_process_frame (GstBackend *self, GstVideoFrame *input_frame, return TRUE; error: - g_set_error (err, GST_BACKEND_ERROR, error.GetCode (), + g_set_error (err, GST_BASE_BACKEND_ERROR, error.GetCode (), "R2Inference Error: (Code:%d) %s", error.GetCode (), error.GetDescription ().c_str ()); return FALSE; } gboolean -gst_backend_set_framework_code (GstBackend *backend, r2i::FrameworkCode code) { - GstBackendPrivate *priv = GST_BACKEND_PRIVATE (backend); +gst_base_backend_set_framework_code (GstBaseBackend *backend, r2i::FrameworkCode code) { + GstBaseBackendPrivate *priv = GST_BASE_BACKEND_PRIVATE (backend); g_return_val_if_fail (priv, FALSE); priv->code = code; @@ -505,15 +505,15 @@ gst_backend_set_framework_code (GstBackend *backend, r2i::FrameworkCode code) { } guint -gst_backend_get_framework_code (GstBackend *backend) { - GstBackendPrivate *priv = GST_BACKEND_PRIVATE (backend); +gst_base_backend_get_framework_code (GstBaseBackend *backend) { + GstBaseBackendPrivate *priv = GST_BASE_BACKEND_PRIVATE (backend); g_return_val_if_fail (priv, -1); return priv->code; } GQuark -gst_backend_error_quark(void) { +gst_base_backend_error_quark(void) { static GQuark q = 0; if (0 == q) { diff --git a/gst-libs/gst/r2inference/gstbackend.h b/gst-libs/gst/r2inference/gstbasebackend.h similarity index 63% rename from gst-libs/gst/r2inference/gstbackend.h rename to gst-libs/gst/r2inference/gstbasebackend.h index eb354813..abd1b239 100644 --- a/gst-libs/gst/r2inference/gstbackend.h +++ b/gst-libs/gst/r2inference/gstbasebackend.h @@ -19,28 +19,28 @@ * */ -#ifndef __GST_BACKEND_H__ -#define __GST_BACKEND_H__ +#ifndef __GST_BASE_BACKEND_H__ +#define __GST_BASE_BACKEND_H__ #include #include G_BEGIN_DECLS -#define GST_TYPE_BACKEND gst_backend_get_type () -G_DECLARE_DERIVABLE_TYPE (GstBackend, gst_backend, GST, BACKEND, GObject); +#define GST_TYPE_BASE_BACKEND gst_base_backend_get_type () +G_DECLARE_DERIVABLE_TYPE (GstBaseBackend, gst_base_backend, GST, BASE_BACKEND, GObject); -struct _GstBackendClass +struct _GstBaseBackendClass { GObjectClass parent_class; }; -GQuark gst_backend_error_quark (void); -gboolean gst_backend_start (GstBackend *, const gchar *, GError **); -gboolean gst_backend_stop (GstBackend *, GError **); -guint gst_backend_get_framework_code (GstBackend *); -gboolean gst_backend_process_frame (GstBackend *, GstVideoFrame *, +GQuark gst_base_backend_error_quark (void); +gboolean gst_base_backend_start (GstBaseBackend *, const gchar *, GError **); +gboolean gst_base_backend_stop (GstBaseBackend *, GError **); +guint gst_base_backend_get_framework_code (GstBaseBackend *); +gboolean gst_base_backend_process_frame (GstBaseBackend *, GstVideoFrame *, gpointer *, gsize *, GError **); G_END_DECLS -#endif //__GST_BACKEND_H__ +#endif //__GST_BASE_BACKEND_H__ diff --git a/gst-libs/gst/r2inference/gstbackendsubclass.h b/gst-libs/gst/r2inference/gstbasebackendsubclass.h similarity index 73% rename from gst-libs/gst/r2inference/gstbackendsubclass.h rename to gst-libs/gst/r2inference/gstbasebackendsubclass.h index 19ceff93..5dea70c0 100644 --- a/gst-libs/gst/r2inference/gstbackendsubclass.h +++ b/gst-libs/gst/r2inference/gstbasebackendsubclass.h @@ -19,25 +19,25 @@ * */ -#ifndef __GST_BACKENDSUBCLASS_H__ -#define __GST_BACKENDSUBCLASS_H__ +#ifndef __GST_BASE_BACKEND_SUBCLASS_H__ +#define __GST_BASE_BACKEND_SUBCLASS_H__ -#include "gstbackend.h" +#include "gstbasebackend.h" #include G_BEGIN_DECLS -void gst_backend_get_property (GObject * object, guint property_id, +void gst_base_backend_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -void gst_backend_set_property (GObject * object, guint property_id, +void gst_base_backend_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -void gst_backend_install_properties (GstBackendClass * klass, +void gst_base_backend_install_properties (GstBaseBackendClass * klass, r2i::FrameworkCode code); -gboolean gst_backend_set_framework_code (GstBackend * backend, +gboolean gst_base_backend_set_framework_code (GstBaseBackend * backend, r2i::FrameworkCode code); gboolean gst_inference_backend_register (const gchar* type_name, r2i::FrameworkCode code); G_END_DECLS -#endif //__GST_BACKENDSUBCLASS_H__ +#endif //__GST_BASE_BACKEND_SUBCLASS_H__ diff --git a/gst-libs/gst/r2inference/gstinferencebackend.cc b/gst-libs/gst/r2inference/gstinferencebackend.cc index 3a6ae67d..f010c48a 100644 --- a/gst-libs/gst/r2inference/gstinferencebackend.cc +++ b/gst-libs/gst/r2inference/gstinferencebackend.cc @@ -19,8 +19,8 @@ * */ -#include "gstbackend.h" -#include "gstbackendsubclass.h" +#include "gstbasebackend.h" +#include "gstbasebackendsubclass.h" #include #include @@ -28,37 +28,37 @@ typedef struct _GstInferenceBackend GstInferenceBackend; struct _GstInferenceBackend { - GstBackend parent; + GstBaseBackend parent; }; typedef struct _GstInferenceBackendClass GstInferenceBackendClass; struct _GstInferenceBackendClass { - GstBackendClass parent_class; + GstBaseBackendClass parent_class; r2i::FrameworkCode code; }; #define GST_BACKEND_CODE_QDATA g_quark_from_static_string("backend-code") -static GstBackendClass *parent_class = NULL; +static GstBaseBackendClass *parent_class = NULL; static void gst_inference_backend_class_init (GstInferenceBackendClass * klass) { - GstBackendClass *bclass = GST_BACKEND_CLASS (klass); + GstBaseBackendClass *bclass = GST_BASE_BACKEND_CLASS (klass); GObjectClass *oclass = G_OBJECT_CLASS (klass); guint code; - parent_class = GST_BACKEND_CLASS (g_type_class_peek_parent (klass)); + parent_class = GST_BASE_BACKEND_CLASS (g_type_class_peek_parent (klass)); code = GPOINTER_TO_UINT (g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), GST_BACKEND_CODE_QDATA)); klass->code = (r2i::FrameworkCode) code; - oclass->set_property = gst_backend_set_property; - oclass->get_property = gst_backend_get_property; - gst_backend_install_properties (bclass, klass->code); + oclass->set_property = gst_base_backend_set_property; + oclass->get_property = gst_base_backend_get_property; + gst_base_backend_install_properties (bclass, klass->code); } static void @@ -66,7 +66,7 @@ gst_inference_backend_init (GstInferenceBackend * self) { GstInferenceBackendClass *klass = (GstInferenceBackendClass *) G_OBJECT_GET_CLASS (self); - gst_backend_set_framework_code (GST_BACKEND (self), klass->code); + gst_base_backend_set_framework_code (GST_BASE_BACKEND (self), klass->code); } gboolean @@ -88,7 +88,7 @@ gst_inference_backend_register (const gchar * type_name, type = g_type_from_name (type_name); if (!type) { - type = g_type_register_static (GST_TYPE_BACKEND, + type = g_type_register_static (GST_TYPE_BASE_BACKEND, type_name, &typeinfo, (GTypeFlags) 0); g_type_set_qdata (type, GST_BACKEND_CODE_QDATA, GUINT_TO_POINTER (code)); diff --git a/gst-libs/gst/r2inference/gstinferencebackends.cc b/gst-libs/gst/r2inference/gstinferencebackends.cc index 2e5e0bd4..70c64862 100644 --- a/gst-libs/gst/r2inference/gstinferencebackends.cc +++ b/gst-libs/gst/r2inference/gstinferencebackends.cc @@ -19,8 +19,8 @@ * */ -#include "gstbackend.h" -#include "gstbackendsubclass.h" +#include "gstbasebackend.h" +#include "gstbasebackendsubclass.h" #include "gstchildinspector.h" #include "gstinferencebackends.h" @@ -114,7 +114,7 @@ static void gst_inference_backends_add_frameworkmeta (r2i::FrameworkMeta meta, gchar ** backends_parameters, r2i::RuntimeError error, guint alignment) { - GstBackend *backend = NULL; + GstBaseBackend *backend = NULL; gchar *parameters, *backend_name; gchar *backend_type_name; GType backend_type; @@ -130,7 +130,7 @@ gst_inference_backends_add_frameworkmeta (r2i::FrameworkMeta meta, } gst_inference_backend_register (backend_type_name, meta.code); backend_type = g_type_from_name (backend_type_name); - backend = (GstBackend *) g_object_new (backend_type, NULL); + backend = (GstBaseBackend *) g_object_new (backend_type, NULL); g_free (backend_type_name); backend_name = diff --git a/gst-libs/gst/r2inference/gstvideoinference.c b/gst-libs/gst/r2inference/gstvideoinference.c index 5b21d2da..cf8c4199 100644 --- a/gst-libs/gst/r2inference/gstvideoinference.c +++ b/gst-libs/gst/r2inference/gstvideoinference.c @@ -22,7 +22,7 @@ #include "gstvideoinference.h" #include "gstinferencebackends.h" #include "gstinferencemeta.h" -#include "gstbackend.h" +#include "gstbasebackend.h" #include @@ -88,7 +88,7 @@ struct _GstVideoInferencePrivate GstPad *sink_model; GstPad *src_model; - GstBackend *backend; + GstBaseBackend *backend; gchar *model_location; @@ -429,7 +429,7 @@ gst_video_inference_start (GstVideoInference * self) goto out; } - if (!gst_backend_start (priv->backend, priv->model_location, &err)) { + if (!gst_base_backend_start (priv->backend, priv->model_location, &err)) { GST_ELEMENT_ERROR (self, LIBRARY, INIT, ("Could not start the selected backend: (%s)", err->message), (NULL)); ret = FALSE; @@ -458,7 +458,7 @@ gst_video_inference_stop (GstVideoInference * self) video_inference_flush_queue (priv->model_queue, &priv->mtx_model_queue); video_inference_flush_queue (priv->bypass_queue, &priv->mtx_bypass_queue); - if (!gst_backend_stop (priv->backend, &err)) { + if (!gst_base_backend_stop (priv->backend, &err)) { GST_ELEMENT_ERROR (self, LIBRARY, INIT, ("Could not stop the selected backend: (%s)", err->message), (NULL)); ret = FALSE; @@ -772,7 +772,7 @@ gst_video_inference_predict (GstVideoInference * self, GST_LOG_OBJECT (self, "Running prediction on frame"); - if (!gst_backend_process_frame (priv->backend, frame, pred, pred_size, + if (!gst_base_backend_process_frame (priv->backend, frame, pred, pred_size, &error)) { GST_ELEMENT_ERROR (self, STREAM, FAILED, ("Could not process using the selected backend: (%s)", error->message), @@ -1388,7 +1388,7 @@ gst_video_inference_finalize (GObject * object) static void gst_video_inference_set_backend (GstVideoInference * self, gint backend) { - GstBackend *backend_new; + GstBaseBackend *backend_new; GType backend_type; GstVideoInferencePrivate *priv = GST_VIDEO_INFERENCE_PRIVATE (self); @@ -1403,7 +1403,7 @@ gst_video_inference_set_backend (GstVideoInference * self, gint backend) g_object_unref (priv->backend); backend_type = gst_inference_backends_search_type (backend); - backend_new = (GstBackend *) g_object_new (backend_type, NULL); + backend_new = (GstBaseBackend *) g_object_new (backend_type, NULL); priv->backend = backend_new; return; @@ -1416,5 +1416,5 @@ gst_video_inference_get_backend_type (GstVideoInference * self) g_return_val_if_fail (priv, -1); - return gst_backend_get_framework_code (priv->backend); + return gst_base_backend_get_framework_code (priv->backend); } diff --git a/gst-libs/gst/r2inference/meson.build b/gst-libs/gst/r2inference/meson.build index e6c5350c..ae0107ed 100644 --- a/gst-libs/gst/r2inference/meson.build +++ b/gst-libs/gst/r2inference/meson.build @@ -1,5 +1,5 @@ gstinference_sources = [ - 'gstbackend.cc', + 'gstbasebackend.cc', 'gstchildinspector.c', 'gstinferencebackend.cc', 'gstinferencebackends.cc', @@ -13,8 +13,8 @@ gstinference_sources = [ ] gstinference_headers = [ - 'gstbackend.h', - 'gstbackendsubclass.h', + 'gstbasebackend.h', + 'gstbasebackendsubclass.h', 'gstchildinspector.h', 'gstinferencebackends.h', 'gstinferencedebug.h', From d848c768be4b35505873636ee0b2d3121d6270c6 Mon Sep 17 00:00:00 2001 From: Melissa Montero Date: Mon, 22 Jun 2020 11:50:10 -0600 Subject: [PATCH 07/12] gstinferencebackends: change enum name and nick for backward compatibility --- gst-libs/gst/r2inference/gstinferencebackends.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/r2inference/gstinferencebackends.cc b/gst-libs/gst/r2inference/gstinferencebackends.cc index 70c64862..6a49429c 100644 --- a/gst-libs/gst/r2inference/gstinferencebackends.cc +++ b/gst-libs/gst/r2inference/gstinferencebackends.cc @@ -99,7 +99,7 @@ gst_inference_backends_search_type (guint id) enum_value = g_enum_get_value (enum_class, id); if (enum_value) { - framework = enum_value->value_nick; + framework = enum_value->value_name; backend_type_name = gst_inference_backends_get_type_name (framework); backend_type = g_type_from_name (backend_type_name); g_free (backend_type_name); @@ -120,7 +120,7 @@ gst_inference_backends_add_frameworkmeta (r2i::FrameworkMeta meta, GType backend_type; gst_inference_backends_enum_register_item (meta.code, - meta.description.c_str (), meta.name.c_str ()); + meta.name.c_str (), meta.label.c_str ()); backend_type_name = gst_inference_backends_get_type_name (meta.name.c_str ()); if (NULL == backend_type_name) { From 4bf8395d191a0bc3911ac89ea9cba755541e688e Mon Sep 17 00:00:00 2001 From: Melissa Montero Date: Mon, 22 Jun 2020 18:24:36 -0600 Subject: [PATCH 08/12] gstinferencebackend: Indent --- gst-libs/gst/r2inference/gstinferencebackend.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/r2inference/gstinferencebackend.cc b/gst-libs/gst/r2inference/gstinferencebackend.cc index f010c48a..4796ad24 100644 --- a/gst-libs/gst/r2inference/gstinferencebackend.cc +++ b/gst-libs/gst/r2inference/gstinferencebackend.cc @@ -35,7 +35,9 @@ typedef struct _GstInferenceBackendClass GstInferenceBackendClass; struct _GstInferenceBackendClass { GstBaseBackendClass parent_class; - r2i::FrameworkCode code; + /* *INDENT-OFF* */ + r2i::FrameworkCode code; + /* *INDENT-ON* */ }; #define GST_BACKEND_CODE_QDATA g_quark_from_static_string("backend-code") From d76c9e711a26992bbe389698a5a5f3ea897ad642 Mon Sep 17 00:00:00 2001 From: Melissa Montero Date: Mon, 22 Jun 2020 18:26:43 -0600 Subject: [PATCH 09/12] gstbasebackend: change debug category to basebackend --- gst-libs/gst/r2inference/gstbasebackend.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gst-libs/gst/r2inference/gstbasebackend.cc b/gst-libs/gst/r2inference/gstbasebackend.cc index 31d75deb..f96566c3 100644 --- a/gst-libs/gst/r2inference/gstbasebackend.cc +++ b/gst-libs/gst/r2inference/gstbasebackend.cc @@ -103,7 +103,7 @@ struct _GstBaseBackendPrivate { }; G_DEFINE_TYPE_WITH_CODE (GstBaseBackend, gst_base_backend, G_TYPE_OBJECT, - GST_DEBUG_CATEGORY_INIT (gst_base_backend_debug_category, "backend", 0, + GST_DEBUG_CATEGORY_INIT (gst_base_backend_debug_category, "basebackend", 0, "debug category for backend parameters"); G_ADD_PRIVATE (GstBaseBackend)); #define GST_BASE_BACKEND_PRIVATE(self) \ From f98b7b87199b71fd4bb94da4f2fc225fcf3e0f41 Mon Sep 17 00:00:00 2001 From: Melissa Montero Date: Tue, 23 Jun 2020 16:31:38 -0600 Subject: [PATCH 10/12] Increase r2inference required version to 0.8.0 --- configure.ac | 2 +- meson.build | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 9c5b2899..2c26d74e 100644 --- a/configure.ac +++ b/configure.ac @@ -316,7 +316,7 @@ if test "$USE_OPENCV" = "yes"; then fi dnl *** r2inference *** -R2INFERENCE_REQ=0.5.2 +R2INFERENCE_REQ=0.8.0 AG_GST_CHECK_FEATURE(R2INFERENCE, [RidgeRun\'s Inference Framework], r2inference, [ AG_GST_PKG_CHECK_MODULES(R2INFERENCE, r2inference-0.0 >= $R2INFERENCE_REQ) ],[],[],[ diff --git a/meson.build b/meson.build index 448dec08..15f13738 100644 --- a/meson.build +++ b/meson.build @@ -21,14 +21,14 @@ api_version = '1.0' # Required versions gst_req = '>= 1.8.0.1' -r2i_req = '>= 0.5.2' +r2i_req = '>= 0.8.0' # Find external dependencies gst_dep = dependency('gstreamer-1.0', version : gst_req) gst_base_dep = dependency('gstreamer-base-1.0', version : gst_req) gst_check_dep = dependency('gstreamer-check-1.0',version : gst_req) gst_video_dep = dependency('gstreamer-video-1.0', version : gst_req) -r2inference_dep = dependency('r2inference-0.0', required : true) +r2inference_dep = dependency('r2inference-0.0', version : r2i_req, required : true) opencv_dep = dependency('opencv', version : ['>= 2.3.1', '< 2.4.13'], required : false) if opencv_dep.found() From e50cbdcc5e0b8b3962ffd30b87d03358778e1ebd Mon Sep 17 00:00:00 2001 From: Melissa Montero Date: Tue, 23 Jun 2020 16:33:20 -0600 Subject: [PATCH 11/12] Match Makefile backslashes --- gst-libs/gst/r2inference/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/r2inference/Makefile.am b/gst-libs/gst/r2inference/Makefile.am index ce325c3f..ca86d892 100644 --- a/gst-libs/gst/r2inference/Makefile.am +++ b/gst-libs/gst/r2inference/Makefile.am @@ -6,7 +6,7 @@ libgstinference_@GST_API_VERSION@_la_SOURCES= \ gstchildinspector.c \ gstinferencemeta.c \ gstinferencebackends.cc \ - gstbasebackend.cc \ + gstbasebackend.cc \ gstinferencepreprocess.c \ gstinferencepostprocess.c \ gstinferencedebug.c \ @@ -40,8 +40,8 @@ gstinferenceinclude_HEADERS= \ gstvideoinference.h \ gstchildinspector.h \ gstinferencebackends.h \ - gstbasebackend.h \ - gstbasebackendsubclass.h \ + gstbasebackend.h \ + gstbasebackendsubclass.h \ gstinferencepreprocess.h \ gstinferencepostprocess.h \ gstinferencedebug.h \ From 9365fc33783a53a8012dc836c938804e18b0fa8f Mon Sep 17 00:00:00 2001 From: Juan Cruz Date: Thu, 25 Jun 2020 17:54:27 -0600 Subject: [PATCH 12/12] Add pfactory verification --- gst-libs/gst/r2inference/gstbasebackend.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/r2inference/gstbasebackend.cc b/gst-libs/gst/r2inference/gstbasebackend.cc index f96566c3..4e731592 100644 --- a/gst-libs/gst/r2inference/gstbasebackend.cc +++ b/gst-libs/gst/r2inference/gstbasebackend.cc @@ -160,7 +160,8 @@ gst_base_backend_install_properties (GstBaseBackendClass *klass, auto factory = r2i::IFrameworkFactory::MakeFactory (code, error); auto pfactory = factory->MakeParameters (error); - error = pfactory->List (params); + if (pfactory) + error = pfactory->List (params); for (auto ¶m : params) { GParamSpec *spec = gst_base_backend_param_to_spec (¶m);