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>
This commit is contained in:
Stéphane Cerveau 2021-02-16 16:11:36 +01:00
parent 8dedf47997
commit 55490732be
6 changed files with 97 additions and 17 deletions

View file

@ -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;
}
gboolean ret = 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 */
ret |= GST_ELEMENT_REGISTER (osssrc, plugin);
ret |= GST_ELEMENT_REGISTER (osssink, plugin);
return TRUE;
}

View file

@ -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);
}
}

View file

@ -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__ */

View file

@ -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)

View file

@ -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);

View file

@ -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],