summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorStéphane Cerveau <scerveau@collabora.com>2021-02-16 16:11:36 +0100
committerStéphane Cerveau <scerveau@collabora.com>2021-03-29 12:45:23 +0200
commit55490732bea4c5703dbc5367ba4af7df91ff5e43 (patch)
tree432a2d777b45efb4e0f0e415ffb69133a99c024d /sys
parent8dedf47997c86116d3ccdd17a63d231bde79a283 (diff)
downloadgstreamer-plugins-good-55490732bea4c5703dbc5367ba4af7df91ff5e43.tar.gz
oss: 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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/876>
Diffstat (limited to 'sys')
-rw-r--r--sys/oss/gstossaudio.c22
-rw-r--r--sys/oss/gstossaudioelement.c47
-rw-r--r--sys/oss/gstossaudioelements.h39
-rw-r--r--sys/oss/gstosssink.c3
-rw-r--r--sys/oss/gstosssrc.c3
-rw-r--r--sys/oss/meson.build2
6 files changed, 98 insertions, 18 deletions
diff --git a/sys/oss/gstossaudio.c b/sys/oss/gstossaudio.c
index 7194e2e84..5d476b4c9 100644
--- a/sys/oss/gstossaudio.c
+++ b/sys/oss/gstossaudio.c
@@ -24,30 +24,18 @@
#include "gst/gst-i18n-plugin.h"
#include "common.h"
+#include "gstossaudioelements.h"
#include "gstosssink.h"
#include "gstosssrc.h"
-GST_DEBUG_CATEGORY (oss_debug);
-#define GST_CAT_DEFAULT oss_debug
static gboolean
plugin_init (GstPlugin * plugin)
{
- if (!gst_element_register (plugin, "osssrc", GST_RANK_SECONDARY,
- GST_TYPE_OSS_SRC) ||
- !gst_element_register (plugin, "osssink", GST_RANK_SECONDARY,
- GST_TYPE_OSSSINK)) {
- return FALSE;
- }
-
- GST_DEBUG_CATEGORY_INIT (oss_debug, "oss", 0, "OSS elements");
-
-#ifdef ENABLE_NLS
- GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
- LOCALEDIR);
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif /* ENABLE_NLS */
+ gboolean ret = FALSE;
+
+ ret |= GST_ELEMENT_REGISTER (osssrc, plugin);
+ ret |= GST_ELEMENT_REGISTER (osssink, plugin);
return TRUE;
}
diff --git a/sys/oss/gstossaudioelement.c b/sys/oss/gstossaudioelement.c
new file mode 100644
index 000000000..1793bca4f
--- /dev/null
+++ b/sys/oss/gstossaudioelement.c
@@ -0,0 +1,47 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gst/gst-i18n-plugin.h"
+
+#include "common.h"
+#include "gstossaudioelements.h"
+
+GST_DEBUG_CATEGORY (oss_debug);
+#define GST_CAT_DEFAULT oss_debug
+
+void
+oss_element_init (GstPlugin * plugin)
+{
+ static gsize res = FALSE;
+ if (g_once_init_enter (&res)) {
+ GST_DEBUG_CATEGORY_INIT (oss_debug, "oss", 0, "OSS elements");
+
+#ifdef ENABLE_NLS
+ GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
+ LOCALEDIR);
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif /* ENABLE_NLS */
+ g_once_init_leave (&res, TRUE);
+ }
+}
diff --git a/sys/oss/gstossaudioelements.h b/sys/oss/gstossaudioelements.h
new file mode 100644
index 000000000..4770a76c6
--- /dev/null
+++ b/sys/oss/gstossaudioelements.h
@@ -0,0 +1,39 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ * @Author: Julian Bouzas <julian.bouzas@collabora.com>
+ *
+ * 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_OSS_ELEMENTS_H__
+#define __GST_OSS_ELEMENTS_H__
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+G_GNUC_INTERNAL void oss_element_init (GstPlugin * plugin);
+
+GST_ELEMENT_REGISTER_DECLARE (osssink);
+GST_ELEMENT_REGISTER_DECLARE (osssrc);
+
+G_END_DECLS
+
+#endif /* __GST_OSS_ELEMENTS_H__ */
diff --git a/sys/oss/gstosssink.c b/sys/oss/gstosssink.c
index 75b2cf788..bae8edf1d 100644
--- a/sys/oss/gstosssink.c
+++ b/sys/oss/gstosssink.c
@@ -66,6 +66,7 @@
#endif /* HAVE_OSS_INCLUDE_IN_SYS */
#include "common.h"
+#include "gstossaudioelements.h"
#include "gstosssink.h"
#include <gst/gst-i18n-plugin.h>
@@ -128,6 +129,8 @@ static GstStaticPadTemplate osssink_sink_factory =
#define gst_oss_sink_parent_class parent_class
G_DEFINE_TYPE (GstOssSink, gst_oss_sink, GST_TYPE_AUDIO_SINK);
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (osssink, "osssink", GST_RANK_SECONDARY,
+ GST_TYPE_OSSSINK, oss_element_init (plugin));
static void
gst_oss_sink_dispose (GObject * object)
diff --git a/sys/oss/gstosssrc.c b/sys/oss/gstosssrc.c
index c4c55f904..a34e1ee87 100644
--- a/sys/oss/gstosssrc.c
+++ b/sys/oss/gstosssrc.c
@@ -60,6 +60,7 @@
#endif /* HAVE_OSS_INCLUDE_IN_SYS */
#include "common.h"
+#include "gstossaudioelements.h"
#include "gstosssrc.h"
#include <gst/gst-i18n-plugin.h>
@@ -79,6 +80,8 @@ enum
#define gst_oss_src_parent_class parent_class
G_DEFINE_TYPE (GstOssSrc, gst_oss_src, GST_TYPE_AUDIO_SRC);
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (osssrc, "osssrc", GST_RANK_SECONDARY,
+ GST_TYPE_OSS_SRC, oss_element_init (plugin));
static void gst_oss_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
diff --git a/sys/oss/meson.build b/sys/oss/meson.build
index 8f8e81ce6..51cc4d34c 100644
--- a/sys/oss/meson.build
+++ b/sys/oss/meson.build
@@ -26,7 +26,7 @@ endif
if have_oss
plugins += [library('gstossaudio',
- 'gstossaudio.c', 'gstosshelper.c', 'gstosssink.c', 'gstosssrc.c',
+ 'gstossaudio.c', 'gstossaudioelement.c', 'gstosshelper.c', 'gstosssink.c', 'gstosssrc.c',
c_args : gst_plugins_good_args,
include_directories : [configinc, libsinc],
dependencies : [gstaudio_dep, gstbase_dep],