equalizer: 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-15 17:27:51 +01:00
parent 4d6a69c655
commit 1f8dd4029b
7 changed files with 69 additions and 25 deletions

View file

@ -893,29 +893,12 @@ gst_iir_equalizer_setup (GstAudioFilter * audio, const GstAudioInfo * info)
return TRUE;
}
static gboolean
plugin_init (GstPlugin * plugin)
void
equalizer_element_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (equalizer_debug, "equalizer", 0, "equalizer");
if (!(gst_element_register (plugin, "equalizer-nbands", GST_RANK_NONE,
GST_TYPE_IIR_EQUALIZER_NBANDS)))
return FALSE;
if (!(gst_element_register (plugin, "equalizer-3bands", GST_RANK_NONE,
GST_TYPE_IIR_EQUALIZER_3BANDS)))
return FALSE;
if (!(gst_element_register (plugin, "equalizer-10bands", GST_RANK_NONE,
GST_TYPE_IIR_EQUALIZER_10BANDS)))
return FALSE;
return TRUE;
static gsize res = FALSE;
if (g_once_init_enter (&res)) {
GST_DEBUG_CATEGORY_INIT (equalizer_debug, "equalizer", 0, "equalizer");
g_once_init_leave (&res, TRUE);
}
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
equalizer,
"GStreamer audio equalizers",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)

View file

@ -23,6 +23,12 @@
#include <gst/audio/gstaudiofilter.h>
void equalizer_element_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (equalizer_nbands);
GST_ELEMENT_REGISTER_DECLARE (equalizer_3bands);
GST_ELEMENT_REGISTER_DECLARE (equalizer_10bands);
typedef struct _GstIirEqualizer GstIirEqualizer;
typedef struct _GstIirEqualizerClass GstIirEqualizerClass;
typedef struct _GstIirEqualizerBand GstIirEqualizerBand;

View file

@ -65,6 +65,9 @@ GST_DEBUG_CATEGORY_EXTERN (equalizer_debug);
#define gst_iir_equalizer_10bands_parent_class parent_class
G_DEFINE_TYPE (GstIirEqualizer10Bands, gst_iir_equalizer_10bands,
GST_TYPE_IIR_EQUALIZER);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (equalizer_10bands, "equalizer-10bands",
GST_RANK_NONE, GST_TYPE_IIR_EQUALIZER_10BANDS,
equalizer_element_init (plugin));
/* equalizer implementation */

View file

@ -56,6 +56,9 @@ GST_DEBUG_CATEGORY_EXTERN (equalizer_debug);
#define gst_iir_equalizer_3bands_parent_class parent_class
G_DEFINE_TYPE (GstIirEqualizer3Bands, gst_iir_equalizer_3bands,
GST_TYPE_IIR_EQUALIZER);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (equalizer_3bands, "equalizer-3bands",
GST_RANK_NONE, GST_TYPE_IIR_EQUALIZER_3BANDS,
equalizer_element_init (plugin));
/* equalizer implementation */

View file

@ -99,7 +99,9 @@ GST_DEBUG_CATEGORY_EXTERN (equalizer_debug);
#define gst_iir_equalizer_nbands_parent_class parent_class
G_DEFINE_TYPE (GstIirEqualizerNBands, gst_iir_equalizer_nbands,
GST_TYPE_IIR_EQUALIZER);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (equalizer_nbands, "equalizer-nbands",
GST_RANK_NONE, GST_TYPE_IIR_EQUALIZER_NBANDS,
equalizer_element_init (plugin));
/* equalizer implementation */
static void

View file

@ -0,0 +1,45 @@
/* GStreamer
* Copyright (C) <2004> Benjamin Otte <otte@gnome.org>
* <2007> Stefan Kost <ensonic@users.sf.net>
* <2007> Sebastian Dröge <slomo@circular-chaos.org>
*
* 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 "gstiirequalizer.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
gboolean ret = FALSE;
ret |= GST_ELEMENT_REGISTER (equalizer_nbands, plugin);
ret |= GST_ELEMENT_REGISTER (equalizer_3bands, plugin);
ret |= GST_ELEMENT_REGISTER (equalizer_10bands, plugin);
return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
equalizer,
"GStreamer audio equalizers",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)

View file

@ -1,8 +1,10 @@
eq_sources = [
'gstiirequalizer.c',
'gstiirequalizerplugin.c',
'gstiirequalizernbands.c',
'gstiirequalizer3bands.c',
'gstiirequalizer10bands.c',
'gstiirequalizerplugin.c',
]
gstequalizer = library('gstequalizer',