oss4: 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>
This commit is contained in:
Stéphane Cerveau 2021-02-16 16:34:48 +01:00
parent 55490732be
commit 31a780a061
8 changed files with 69 additions and 28 deletions

View file

@ -0,0 +1,47 @@
/* GStreamer OSS4 audio plugin
* Copyright (C) 2007-2008 Tim-Philipp Müller <tim centricular net>
*
* 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.
*/
/* FIXME 0.11: suppress warnings for deprecated API such as GValueArray
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "oss4-sink.h"
#include "oss4-source.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
gboolean ret = FALSE;
ret |= GST_ELEMENT_REGISTER (oss4sink, plugin);
ret |= GST_ELEMENT_REGISTER (oss4src, plugin);
return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
oss4,
"Open Sound System (OSS) version 4 support for GStreamer",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)

View file

@ -18,7 +18,7 @@ if have_oss4
message('Required headers found, building Open Sound System 4 plugin.')
plugins += [library('gstoss4',
'oss4-audio.c', 'oss4-property-probe.c', 'oss4-sink.c', 'oss4-source.c',
'gstoss4audioplugin.c', 'oss4-audio.c', 'oss4-property-probe.c', 'oss4-sink.c', 'oss4-source.c',
c_args : gst_plugins_good_args,
include_directories : [configinc, libsinc],
dependencies : [gstaudio_dep, gstbase_dep],

View file

@ -746,36 +746,22 @@ gst_oss4_audio_find_device (GstObject * oss)
return ret;
}
static gboolean
plugin_init (GstPlugin * plugin)
void
oss4_element_init (GstPlugin * plugin)
{
gint rank;
GST_DEBUG_CATEGORY_INIT (oss4sink_debug, "oss4sink", 0, "OSS4 audio sink");
GST_DEBUG_CATEGORY_INIT (oss4src_debug, "oss4src", 0, "OSS4 audio src");
GST_DEBUG_CATEGORY_INIT (oss4mixer_debug, "oss4mixer", 0, "OSS4 mixer");
GST_DEBUG_CATEGORY_INIT (oss4_debug, "oss4", 0, "OSS4 plugin");
static gsize res = FALSE;
if (g_once_init_enter (&res)) {
GST_DEBUG_CATEGORY_INIT (oss4sink_debug, "oss4sink", 0, "OSS4 audio sink");
GST_DEBUG_CATEGORY_INIT (oss4src_debug, "oss4src", 0, "OSS4 audio src");
GST_DEBUG_CATEGORY_INIT (oss4mixer_debug, "oss4mixer", 0, "OSS4 mixer");
GST_DEBUG_CATEGORY_INIT (oss4_debug, "oss4", 0, "OSS4 plugin");
#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");
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
/* we want a higher rank than the legacy OSS elements have now */
rank = GST_RANK_SECONDARY + 1;
if (!gst_element_register (plugin, "oss4sink", rank, GST_TYPE_OSS4_SINK) ||
!gst_element_register (plugin, "oss4src", rank, GST_TYPE_OSS4_SOURCE)) {
return FALSE;
g_once_init_leave (&res, TRUE);
}
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
oss4,
"Open Sound System (OSS) version 4 support for GStreamer",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)

View file

@ -23,6 +23,8 @@
#include <gst/gst.h>
#include <gst/audio/audio.h>
G_GNUC_INTERNAL void oss4_element_init (GstPlugin * plugin);
/* This is the minimum version we require */
#define GST_MIN_OSS4_VERSION 0x040003

View file

@ -104,6 +104,8 @@ enum
#define gst_oss4_sink_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstOss4Sink, gst_oss4_sink,
GST_TYPE_AUDIO_SINK, G_IMPLEMENT_INTERFACE (GST_TYPE_STREAM_VOLUME, NULL));
GST_ELEMENT_REGISTER_DEFINE (oss4sink, "oss4sink", GST_RANK_SECONDARY + 1,
GST_TYPE_OSS4_SINK);
static void
gst_oss4_sink_dispose (GObject * object)

View file

@ -54,6 +54,7 @@ struct _GstOss4SinkClass {
};
GType gst_oss4_sink_get_type (void);
GST_ELEMENT_REGISTER_DECLARE (oss4sink);
G_END_DECLS

View file

@ -73,6 +73,8 @@ enum
#define gst_oss4_source_parent_class parent_class
G_DEFINE_TYPE (GstOss4Source, gst_oss4_source, GST_TYPE_AUDIO_SRC);
GST_ELEMENT_REGISTER_DEFINE (oss4src, "oss4src", GST_RANK_SECONDARY + 1,
GST_TYPE_OSS4_SOURCE);
static void gst_oss4_source_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);

View file

@ -52,6 +52,7 @@ struct _GstOss4SourceClass {
};
GType gst_oss4_source_get_type (void);
GST_ELEMENT_REGISTER_DECLARE (oss4src);
G_END_DECLS