From da9e012e8a0b82e9487ab9802162023d87d63d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Fri, 26 Mar 2021 11:00:50 +0100 Subject: plugins-sys: allow per feature registration Split plugin into features including dynamic types which can be indiviually registered during a static build. More details here: https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199 https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661 Part-of: --- sys/ipcpipeline/gstipcpipeline.c | 16 +++++--------- sys/ipcpipeline/gstipcpipelineelement.c | 37 ++++++++++++++++++++++++++++++++ sys/ipcpipeline/gstipcpipelineelements.h | 37 ++++++++++++++++++++++++++++++++ sys/ipcpipeline/gstipcpipelinesink.c | 4 ++++ sys/ipcpipeline/gstipcpipelinesrc.c | 4 ++++ sys/ipcpipeline/gstipcslavepipeline.c | 4 ++++ sys/ipcpipeline/meson.build | 1 + 7 files changed, 92 insertions(+), 11 deletions(-) create mode 100644 sys/ipcpipeline/gstipcpipelineelement.c create mode 100644 sys/ipcpipeline/gstipcpipelineelements.h (limited to 'sys/ipcpipeline') diff --git a/sys/ipcpipeline/gstipcpipeline.c b/sys/ipcpipeline/gstipcpipeline.c index 4d647d49d..5b2f5c53e 100644 --- a/sys/ipcpipeline/gstipcpipeline.c +++ b/sys/ipcpipeline/gstipcpipeline.c @@ -22,21 +22,15 @@ #include "config.h" #endif -#include "gstipcpipelinecomm.h" -#include "gstipcpipelinesink.h" -#include "gstipcpipelinesrc.h" -#include "gstipcslavepipeline.h" +#include "gstipcpipelineelements.h" + static gboolean plugin_init (GstPlugin * plugin) { - gst_ipc_pipeline_comm_plugin_init (); - gst_element_register (plugin, "ipcpipelinesrc", GST_RANK_NONE, - GST_TYPE_IPC_PIPELINE_SRC); - gst_element_register (plugin, "ipcpipelinesink", GST_RANK_NONE, - GST_TYPE_IPC_PIPELINE_SINK); - gst_element_register (plugin, "ipcslavepipeline", GST_RANK_NONE, - GST_TYPE_IPC_SLAVE_PIPELINE); + GST_ELEMENT_REGISTER (ipcpipelinesrc, plugin); + GST_ELEMENT_REGISTER (ipcpipelinesink, plugin); + GST_ELEMENT_REGISTER (ipcslavepipeline, plugin); return TRUE; } diff --git a/sys/ipcpipeline/gstipcpipelineelement.c b/sys/ipcpipeline/gstipcpipelineelement.c new file mode 100644 index 000000000..ce22760d7 --- /dev/null +++ b/sys/ipcpipeline/gstipcpipelineelement.c @@ -0,0 +1,37 @@ +/* GStreamer + * Copyright (C) 2017 YouView TV Ltd + * Author: George Kiagiadakis + * + * 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., 51 Franklin Street, Suite 500, + * Boston, MA 02110-1335, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gstipcpipelineelements.h" +#include "gstipcpipelinecomm.h" + + +void +icepipeline_element_init (GstPlugin * plugin) +{ + static gsize res = FALSE; + if (g_once_init_enter (&res)) { + gst_ipc_pipeline_comm_plugin_init (); + g_once_init_leave (&res, TRUE); + } +} diff --git a/sys/ipcpipeline/gstipcpipelineelements.h b/sys/ipcpipeline/gstipcpipelineelements.h new file mode 100644 index 000000000..97469221d --- /dev/null +++ b/sys/ipcpipeline/gstipcpipelineelements.h @@ -0,0 +1,37 @@ +/* GStreamer + * Copyright (C) 2017 YouView TV Ltd + * Author: George Kiagiadakis + * + * 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., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef __GST_IPCPIPELINE_ELEMENTS_H__ +#define __GST_IPCPIPELINE_ELEMENTS_H__ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +void icepipeline_element_init (GstPlugin * plugin); + +GST_ELEMENT_REGISTER_DECLARE (ipcpipelinesink); +GST_ELEMENT_REGISTER_DECLARE (ipcpipelinesrc); +GST_ELEMENT_REGISTER_DECLARE (ipcslavepipeline); + +#endif /* __GST_IPCPIPELINE_ELEMENTS_H__ */ diff --git a/sys/ipcpipeline/gstipcpipelinesink.c b/sys/ipcpipeline/gstipcpipelinesink.c index 398bbf8e6..cc31ebcb7 100644 --- a/sys/ipcpipeline/gstipcpipelinesink.c +++ b/sys/ipcpipeline/gstipcpipelinesink.c @@ -73,6 +73,7 @@ # include "config.h" #endif +#include "gstipcpipelineelements.h" #include "gstipcpipelinesink.h" static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", @@ -109,6 +110,9 @@ enum #define gst_ipc_pipeline_sink_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstIpcPipelineSink, gst_ipc_pipeline_sink, GST_TYPE_ELEMENT, _do_init); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (ipcpipelinesink, "ipcpipelinesink", + GST_RANK_NONE, GST_TYPE_IPC_PIPELINE_SINK, + icepipeline_element_init (plugin)); static void gst_ipc_pipeline_sink_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); diff --git a/sys/ipcpipeline/gstipcpipelinesrc.c b/sys/ipcpipeline/gstipcpipelinesrc.c index fbb756819..9d46d63b0 100644 --- a/sys/ipcpipeline/gstipcpipelinesrc.c +++ b/sys/ipcpipeline/gstipcpipelinesrc.c @@ -40,6 +40,7 @@ # include "config.h" #endif +#include "gstipcpipelineelements.h" #include "gstipcpipelinesrc.h" static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", @@ -79,6 +80,9 @@ static GQuark QUARK_UPSTREAM; #define gst_ipc_pipeline_src_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstIpcPipelineSrc, gst_ipc_pipeline_src, GST_TYPE_ELEMENT, _do_init); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (ipcpipelinesrc, "ipcpipelinesrc", + GST_RANK_NONE, GST_TYPE_IPC_PIPELINE_SRC, + icepipeline_element_init (plugin)); static void gst_ipc_pipeline_src_finalize (GObject * object); static void gst_ipc_pipeline_src_dispose (GObject * object); diff --git a/sys/ipcpipeline/gstipcslavepipeline.c b/sys/ipcpipeline/gstipcslavepipeline.c index 3ec512ef8..90de4e939 100644 --- a/sys/ipcpipeline/gstipcslavepipeline.c +++ b/sys/ipcpipeline/gstipcslavepipeline.c @@ -42,6 +42,7 @@ #include +#include "gstipcpipelineelements.h" #include "gstipcpipelinesrc.h" #include "gstipcslavepipeline.h" @@ -53,6 +54,9 @@ GST_DEBUG_CATEGORY_STATIC (gst_ipcslavepipeline_debug); #define gst_ipc_slave_pipeline_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstIpcSlavePipeline, gst_ipc_slave_pipeline, GST_TYPE_PIPELINE, _do_init); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (ipcslavepipeline, "ipcslavepipeline", + GST_RANK_NONE, GST_TYPE_IPC_SLAVE_PIPELINE, + icepipeline_element_init (plugin)); static gboolean gst_ipc_slave_pipeline_post_message (GstElement * element, GstMessage * message); diff --git a/sys/ipcpipeline/meson.build b/sys/ipcpipeline/meson.build index aa7ce399a..8d449a020 100644 --- a/sys/ipcpipeline/meson.build +++ b/sys/ipcpipeline/meson.build @@ -1,5 +1,6 @@ ipcpipeline_sources = [ 'gstipcpipeline.c', + 'gstipcpipelineelement.c', 'gstipcpipelinecomm.c', 'gstipcpipelinesink.c', 'gstipcpipelinesrc.c', -- cgit v1.2.1