diff --git a/gst/equalizer/gstiirequalizer.c b/gst/equalizer/gstiirequalizer.c index e78d77959d..5ebd9d26de 100644 --- a/gst/equalizer/gstiirequalizer.c +++ b/gst/equalizer/gstiirequalizer.c @@ -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) diff --git a/gst/equalizer/gstiirequalizer.h b/gst/equalizer/gstiirequalizer.h index 3ba70eed6a..6d8a21415a 100644 --- a/gst/equalizer/gstiirequalizer.h +++ b/gst/equalizer/gstiirequalizer.h @@ -23,6 +23,12 @@ #include +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; diff --git a/gst/equalizer/gstiirequalizer10bands.c b/gst/equalizer/gstiirequalizer10bands.c index d8492f6586..97c60c6b9c 100644 --- a/gst/equalizer/gstiirequalizer10bands.c +++ b/gst/equalizer/gstiirequalizer10bands.c @@ -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 */ diff --git a/gst/equalizer/gstiirequalizer3bands.c b/gst/equalizer/gstiirequalizer3bands.c index 67ab2c4ccd..3ea1667196 100644 --- a/gst/equalizer/gstiirequalizer3bands.c +++ b/gst/equalizer/gstiirequalizer3bands.c @@ -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 */ diff --git a/gst/equalizer/gstiirequalizernbands.c b/gst/equalizer/gstiirequalizernbands.c index da7ea33418..2f9f9a4040 100644 --- a/gst/equalizer/gstiirequalizernbands.c +++ b/gst/equalizer/gstiirequalizernbands.c @@ -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 diff --git a/gst/equalizer/gstiirequalizerplugin.c b/gst/equalizer/gstiirequalizerplugin.c new file mode 100644 index 0000000000..74af309620 --- /dev/null +++ b/gst/equalizer/gstiirequalizerplugin.c @@ -0,0 +1,45 @@ +/* GStreamer + * Copyright (C) <2004> Benjamin Otte + * <2007> Stefan Kost + * <2007> Sebastian Dröge + * + * 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) diff --git a/gst/equalizer/meson.build b/gst/equalizer/meson.build index 73fc8576f9..ef796f830e 100644 --- a/gst/equalizer/meson.build +++ b/gst/equalizer/meson.build @@ -1,8 +1,10 @@ eq_sources = [ 'gstiirequalizer.c', + 'gstiirequalizerplugin.c', 'gstiirequalizernbands.c', 'gstiirequalizer3bands.c', 'gstiirequalizer10bands.c', + 'gstiirequalizerplugin.c', ] gstequalizer = library('gstequalizer',