openal: 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-bad/-/merge_requests/2038>
This commit is contained in:
Stéphane Cerveau 2021-02-18 10:52:51 +01:00 committed by GStreamer Marge Bot
parent 3f1c8d9307
commit 9196e71f07
6 changed files with 97 additions and 18 deletions

View file

@ -26,32 +26,19 @@
#include "config.h"
#endif
#include "gstopenalsink.h"
#include "gstopenalsrc.h"
#include "gstopenalelements.h"
#include <gst/gst-i18n-plugin.h>
GST_DEBUG_CATEGORY (openal_debug);
static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "openalsink", GST_RANK_SECONDARY,
GST_TYPE_OPENAL_SINK))
return FALSE;
gboolean ret = FALSE;
if (!gst_element_register (plugin, "openalsrc", GST_RANK_SECONDARY,
GST_TYPE_OPENAL_SRC))
return FALSE;
ret |= GST_ELEMENT_REGISTER (openalsink, plugin);
ret |= GST_ELEMENT_REGISTER (openalsrc, 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");
#endif
GST_DEBUG_CATEGORY_INIT (openal_debug, "openal", 0, "openal plugins");
return TRUE;
}

View file

@ -0,0 +1,51 @@
/*
* GStreamer openal plugin
*
* Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
* Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
* Copyright (C) 2009-2010 Chris Robinson <chris.kcat@gmail.com>
* Copyright (C) 2013 Juan Manuel Borges Caño <juanmabcmail@gmail.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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstopenalelements.h"
#include "gstopenalsink.h"
#include "gstopenalsrc.h"
#include <gst/gst-i18n-plugin.h>
GST_DEBUG_CATEGORY (openal_debug);
void
openal_element_init (GstPlugin * plugin)
{
static gsize res = FALSE;
if (g_once_init_enter (&res)) {
#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
GST_DEBUG_CATEGORY_INIT (openal_debug, "openal", 0, "openal plugins");
g_once_init_leave (&res, TRUE);
}
}

View file

@ -0,0 +1,35 @@
/* GStreamer
* Copyright (C) <2020> The Gstreamer Contributors.
*
* 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_OPENAL_ELEMENTS_H__
#define __GST_OPENAL_ELEMENTS_H__
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gst/gst.h>
void openal_element_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (openalsink);
GST_ELEMENT_REGISTER_DECLARE (openalsrc);
#endif /* __GST_OPENAL_ELEMENTS_H__ */

View file

@ -61,6 +61,7 @@
GST_DEBUG_CATEGORY_EXTERN (openal_debug);
#define GST_CAT_DEFAULT openal_debug
#include "gstopenalelements.h"
#include "gstopenalsink.h"
static void gst_openal_sink_dispose (GObject * object);
@ -159,6 +160,8 @@ checkALError (const char *fname, unsigned int fline)
#define checkALError() checkALError(__FILE__, __LINE__)
G_DEFINE_TYPE (GstOpenALSink, gst_openal_sink, GST_TYPE_AUDIO_SINK);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (openalsink, "openalsink",
GST_RANK_SECONDARY, GST_TYPE_OPENAL_SINK, openal_element_init (plugin));
static void
gst_openal_sink_dispose (GObject * object)

View file

@ -81,6 +81,7 @@
GST_DEBUG_CATEGORY_EXTERN (openal_debug);
#define GST_CAT_DEFAULT openal_debug
#include "gstopenalelements.h"
#include "gstopenalsrc.h"
static void gst_openal_src_dispose (GObject * object);
@ -140,6 +141,8 @@ static GstStaticPadTemplate openalsrc_factory = GST_STATIC_PAD_TEMPLATE ("src",
);
G_DEFINE_TYPE (GstOpenalSrc, gst_openal_src, GST_TYPE_AUDIO_SRC);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (openalsrc, "openalsrc",
GST_RANK_SECONDARY, GST_TYPE_OPENAL_SRC, openal_element_init (plugin));
static void
gst_openal_src_dispose (GObject * object)

View file

@ -2,7 +2,7 @@ openal_dep = dependency('openal', method: 'pkg-config', version: '>= 1.14', requ
if openal_dep.found()
gstopenal = library('gstopenal',
'gstopenal.c', 'gstopenalsink.c', 'gstopenalsrc.c',
'gstopenal.c', 'gstopenalelement.c', 'gstopenalsink.c', 'gstopenalsrc.c',
c_args: gst_plugins_bad_args,
include_directories: [configinc, libsinc],
dependencies: [gstaudio_dep, openal_dep],