From d8fa279161a2a9092caf6d49e2ed14189e4a1505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Fri, 12 Feb 2021 15:27:31 +0100 Subject: [PATCH] audiofx: 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: --- gst/audiofx/audioamplify.c | 2 ++ gst/audiofx/audioamplify.h | 2 ++ gst/audiofx/audiochebband.c | 2 ++ gst/audiofx/audiochebband.h | 2 ++ gst/audiofx/audiocheblimit.c | 2 ++ gst/audiofx/audiocheblimit.h | 2 ++ gst/audiofx/audiodynamic.c | 2 ++ gst/audiofx/audiodynamic.h | 2 ++ gst/audiofx/audioecho.c | 2 ++ gst/audiofx/audioecho.h | 2 ++ gst/audiofx/audiofirfilter.c | 2 ++ gst/audiofx/audiofirfilter.h | 2 ++ gst/audiofx/audiofx.c | 45 ++++++++++++++--------------------- gst/audiofx/audioiirfilter.c | 2 ++ gst/audiofx/audioiirfilter.h | 2 ++ gst/audiofx/audioinvert.c | 2 ++ gst/audiofx/audioinvert.h | 2 ++ gst/audiofx/audiokaraoke.c | 2 ++ gst/audiofx/audiokaraoke.h | 2 ++ gst/audiofx/audiopanorama.c | 2 ++ gst/audiofx/audiopanorama.h | 2 ++ gst/audiofx/audiowsincband.c | 2 ++ gst/audiofx/audiowsincband.h | 2 ++ gst/audiofx/audiowsinclimit.c | 2 ++ gst/audiofx/audiowsinclimit.h | 2 ++ gst/audiofx/gstscaletempo.c | 2 ++ gst/audiofx/gstscaletempo.h | 2 ++ gst/audiofx/gststereo.c | 1 + gst/audiofx/gststereo.h | 2 ++ 29 files changed, 73 insertions(+), 27 deletions(-) diff --git a/gst/audiofx/audioamplify.c b/gst/audiofx/audioamplify.c index 13bcab86fe..8228ebdbdc 100644 --- a/gst/audiofx/audioamplify.c +++ b/gst/audiofx/audioamplify.c @@ -103,6 +103,8 @@ gst_audio_amplify_clipping_method_get_type (void) " layout=(string) {interleaved, non-interleaved}" G_DEFINE_TYPE (GstAudioAmplify, gst_audio_amplify, GST_TYPE_AUDIO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (audioamplify, "audioamplify", + GST_RANK_NONE, GST_TYPE_AUDIO_AMPLIFY); static gboolean gst_audio_amplify_set_process_function (GstAudioAmplify * filter, gint clipping, GstAudioFormat format); diff --git a/gst/audiofx/audioamplify.h b/gst/audiofx/audioamplify.h index 573eed1555..24fc62fa87 100644 --- a/gst/audiofx/audioamplify.h +++ b/gst/audiofx/audioamplify.h @@ -58,5 +58,7 @@ struct _GstAudioAmplifyClass GType gst_audio_amplify_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audioamplify); + G_END_DECLS #endif /* __GST_AUDIO_AMPLIFY_H__ */ diff --git a/gst/audiofx/audiochebband.c b/gst/audiofx/audiochebband.c index 02686a6186..b318e557a8 100644 --- a/gst/audiofx/audiochebband.c +++ b/gst/audiofx/audiochebband.c @@ -100,6 +100,8 @@ enum #define gst_audio_cheb_band_parent_class parent_class G_DEFINE_TYPE (GstAudioChebBand, gst_audio_cheb_band, GST_TYPE_AUDIO_FX_BASE_IIR_FILTER); +GST_ELEMENT_REGISTER_DEFINE (audiochebband, "audiochebband", + GST_RANK_NONE, GST_TYPE_AUDIO_CHEB_BAND); static void gst_audio_cheb_band_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); diff --git a/gst/audiofx/audiochebband.h b/gst/audiofx/audiochebband.h index 58bdaf0e34..c8c2187683 100644 --- a/gst/audiofx/audiochebband.h +++ b/gst/audiofx/audiochebband.h @@ -60,5 +60,7 @@ struct _GstAudioChebBandClass GType gst_audio_cheb_band_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audiochebband); + G_END_DECLS #endif /* __GST_AUDIO_CHEB_BAND_H__ */ diff --git a/gst/audiofx/audiocheblimit.c b/gst/audiofx/audiocheblimit.c index 0f7e8dc86a..f9d2a4750a 100644 --- a/gst/audiofx/audiocheblimit.c +++ b/gst/audiofx/audiocheblimit.c @@ -95,6 +95,8 @@ enum #define gst_audio_cheb_limit_parent_class parent_class G_DEFINE_TYPE (GstAudioChebLimit, gst_audio_cheb_limit, GST_TYPE_AUDIO_FX_BASE_IIR_FILTER); +GST_ELEMENT_REGISTER_DEFINE (audiocheblimit, "audiocheblimit", + GST_RANK_NONE, GST_TYPE_AUDIO_CHEB_LIMIT); static void gst_audio_cheb_limit_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); diff --git a/gst/audiofx/audiocheblimit.h b/gst/audiofx/audiocheblimit.h index 19309601e7..4c6392141c 100644 --- a/gst/audiofx/audiocheblimit.h +++ b/gst/audiofx/audiocheblimit.h @@ -61,6 +61,8 @@ struct _GstAudioChebLimitClass GType gst_audio_cheb_limit_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audiocheblimit); + G_END_DECLS #endif /* __GST_AUDIO_CHEB_LIMIT_H__ */ diff --git a/gst/audiofx/audiodynamic.c b/gst/audiofx/audiodynamic.c index 07cb215d1a..a244268548 100644 --- a/gst/audiofx/audiodynamic.c +++ b/gst/audiofx/audiodynamic.c @@ -76,6 +76,8 @@ enum " layout=(string) {interleaved, non-interleaved}" G_DEFINE_TYPE (GstAudioDynamic, gst_audio_dynamic, GST_TYPE_AUDIO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (audiodynamic, "audiodynamic", + GST_RANK_NONE, GST_TYPE_AUDIO_DYNAMIC); static void gst_audio_dynamic_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); diff --git a/gst/audiofx/audiodynamic.h b/gst/audiofx/audiodynamic.h index ff1e4fb945..246a56496a 100644 --- a/gst/audiofx/audiodynamic.h +++ b/gst/audiofx/audiodynamic.h @@ -58,6 +58,8 @@ struct _GstAudioDynamicClass GType gst_audio_dynamic_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audiodynamic); + G_END_DECLS #endif /* __GST_AUDIO_DYNAMIC_H__ */ diff --git a/gst/audiofx/audioecho.c b/gst/audiofx/audioecho.c index 948abf7ca2..70af624a2d 100644 --- a/gst/audiofx/audioecho.c +++ b/gst/audiofx/audioecho.c @@ -85,6 +85,8 @@ enum #define gst_audio_echo_parent_class parent_class G_DEFINE_TYPE (GstAudioEcho, gst_audio_echo, GST_TYPE_AUDIO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (audioecho, "audioecho", + GST_RANK_NONE, GST_TYPE_AUDIO_ECHO); static void gst_audio_echo_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); diff --git a/gst/audiofx/audioecho.h b/gst/audiofx/audioecho.h index 51689eda2d..b5eb5d6fe0 100644 --- a/gst/audiofx/audioecho.h +++ b/gst/audiofx/audioecho.h @@ -68,6 +68,8 @@ struct _GstAudioEchoClass GType gst_audio_echo_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audioecho); + G_END_DECLS #endif /* __GST_AUDIO_ECHO_H__ */ diff --git a/gst/audiofx/audiofirfilter.c b/gst/audiofx/audiofirfilter.c index f059685e05..fa1df30353 100644 --- a/gst/audiofx/audiofirfilter.c +++ b/gst/audiofx/audiofirfilter.c @@ -84,6 +84,8 @@ static guint gst_audio_fir_filter_signals[LAST_SIGNAL] = { 0, }; #define gst_audio_fir_filter_parent_class parent_class G_DEFINE_TYPE (GstAudioFIRFilter, gst_audio_fir_filter, GST_TYPE_AUDIO_FX_BASE_FIR_FILTER); +GST_ELEMENT_REGISTER_DEFINE (audiofirfilter, "audiofirfilter", + GST_RANK_NONE, GST_TYPE_AUDIO_FIR_FILTER); static void gst_audio_fir_filter_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); diff --git a/gst/audiofx/audiofirfilter.h b/gst/audiofx/audiofirfilter.h index f3b347583b..e6f18ce711 100644 --- a/gst/audiofx/audiofirfilter.h +++ b/gst/audiofx/audiofirfilter.h @@ -66,6 +66,8 @@ struct _GstAudioFIRFilterClass { GType gst_audio_fir_filter_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audiofirfilter); + G_END_DECLS #endif /* __GST_AUDIO_FIR_FILTER_H__ */ diff --git a/gst/audiofx/audiofx.c b/gst/audiofx/audiofx.c index b44a622807..dae58ead60 100644 --- a/gst/audiofx/audiofx.c +++ b/gst/audiofx/audiofx.c @@ -47,33 +47,24 @@ static gboolean plugin_init (GstPlugin * plugin) { - return (gst_element_register (plugin, "audiopanorama", GST_RANK_NONE, - GST_TYPE_AUDIO_PANORAMA) && - gst_element_register (plugin, "audioinvert", GST_RANK_NONE, - GST_TYPE_AUDIO_INVERT) && - gst_element_register (plugin, "audiokaraoke", GST_RANK_NONE, - GST_TYPE_AUDIO_KARAOKE) && - gst_element_register (plugin, "audioamplify", GST_RANK_NONE, - GST_TYPE_AUDIO_AMPLIFY) && - gst_element_register (plugin, "audiodynamic", GST_RANK_NONE, - GST_TYPE_AUDIO_DYNAMIC) && - gst_element_register (plugin, "audiocheblimit", GST_RANK_NONE, - GST_TYPE_AUDIO_CHEB_LIMIT) && - gst_element_register (plugin, "audiochebband", GST_RANK_NONE, - GST_TYPE_AUDIO_CHEB_BAND) && - gst_element_register (plugin, "audioiirfilter", GST_RANK_NONE, - GST_TYPE_AUDIO_IIR_FILTER) && - gst_element_register (plugin, "audiowsinclimit", GST_RANK_NONE, - GST_TYPE_AUDIO_WSINC_LIMIT) && - gst_element_register (plugin, "audiowsincband", GST_RANK_NONE, - GST_TYPE_AUDIO_WSINC_BAND) && - gst_element_register (plugin, "audiofirfilter", GST_RANK_NONE, - GST_TYPE_AUDIO_FIR_FILTER) && - gst_element_register (plugin, "audioecho", GST_RANK_NONE, - GST_TYPE_AUDIO_ECHO) && - gst_element_register (plugin, "scaletempo", GST_RANK_NONE, - GST_TYPE_SCALETEMPO) && - gst_element_register (plugin, "stereo", GST_RANK_NONE, GST_TYPE_STEREO)); + gboolean ret = FALSE; + + ret |= GST_ELEMENT_REGISTER (audiopanorama, plugin); + ret |= GST_ELEMENT_REGISTER (audioinvert, plugin); + ret |= GST_ELEMENT_REGISTER (audiokaraoke, plugin); + ret |= GST_ELEMENT_REGISTER (audioamplify, plugin); + ret |= GST_ELEMENT_REGISTER (audiodynamic, plugin); + ret |= GST_ELEMENT_REGISTER (audiocheblimit, plugin); + ret |= GST_ELEMENT_REGISTER (audiochebband, plugin); + ret |= GST_ELEMENT_REGISTER (audioiirfilter, plugin); + ret |= GST_ELEMENT_REGISTER (audiowsinclimit, plugin); + ret |= GST_ELEMENT_REGISTER (audiowsincband, plugin); + ret |= GST_ELEMENT_REGISTER (audiofirfilter, plugin); + ret |= GST_ELEMENT_REGISTER (audioecho, plugin); + ret |= GST_ELEMENT_REGISTER (scaletempo, plugin); + ret |= GST_ELEMENT_REGISTER (stereo, plugin); + + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/audiofx/audioiirfilter.c b/gst/audiofx/audioiirfilter.c index 867bc9bf8f..fae565c9c4 100644 --- a/gst/audiofx/audioiirfilter.c +++ b/gst/audiofx/audioiirfilter.c @@ -80,6 +80,8 @@ static guint gst_audio_iir_filter_signals[LAST_SIGNAL] = { 0, }; #define gst_audio_iir_filter_parent_class parent_class G_DEFINE_TYPE (GstAudioIIRFilter, gst_audio_iir_filter, GST_TYPE_AUDIO_FX_BASE_IIR_FILTER); +GST_ELEMENT_REGISTER_DEFINE (audioiirfilter, "audioiirfilter", + GST_RANK_NONE, GST_TYPE_AUDIO_IIR_FILTER); static void gst_audio_iir_filter_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); diff --git a/gst/audiofx/audioiirfilter.h b/gst/audiofx/audioiirfilter.h index ab39c5be9f..df3e51843e 100644 --- a/gst/audiofx/audioiirfilter.h +++ b/gst/audiofx/audioiirfilter.h @@ -65,6 +65,8 @@ struct _GstAudioIIRFilterClass { GType gst_audio_iir_filter_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audioiirfilter); + G_END_DECLS #endif /* __GST_AUDIO_IIR_FILTER_H__ */ diff --git a/gst/audiofx/audioinvert.c b/gst/audiofx/audioinvert.c index eeb3e784b0..a51735304f 100644 --- a/gst/audiofx/audioinvert.c +++ b/gst/audiofx/audioinvert.c @@ -71,6 +71,8 @@ enum " layout=(string) {interleaved, non-interleaved}" G_DEFINE_TYPE (GstAudioInvert, gst_audio_invert, GST_TYPE_AUDIO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (audioinvert, "audioinvert", + GST_RANK_NONE, GST_TYPE_AUDIO_INVERT); static void gst_audio_invert_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); diff --git a/gst/audiofx/audioinvert.h b/gst/audiofx/audioinvert.h index cbb5b3f441..342d0df394 100644 --- a/gst/audiofx/audioinvert.h +++ b/gst/audiofx/audioinvert.h @@ -56,5 +56,7 @@ struct _GstAudioInvertClass GType gst_audio_invert_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audioinvert); + G_END_DECLS #endif /* __GST_AUDIO_INVERT_H__ */ diff --git a/gst/audiofx/audiokaraoke.c b/gst/audiofx/audiokaraoke.c index 0d02926033..2bd8dfdd6e 100644 --- a/gst/audiofx/audiokaraoke.c +++ b/gst/audiofx/audiokaraoke.c @@ -78,6 +78,8 @@ enum " layout=(string) interleaved" G_DEFINE_TYPE (GstAudioKaraoke, gst_audio_karaoke, GST_TYPE_AUDIO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (audiokaraoke, "audiokaraoke", + GST_RANK_NONE, GST_TYPE_AUDIO_KARAOKE); static void gst_audio_karaoke_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); diff --git a/gst/audiofx/audiokaraoke.h b/gst/audiofx/audiokaraoke.h index 1391efc33c..5fef3924d3 100644 --- a/gst/audiofx/audiokaraoke.h +++ b/gst/audiofx/audiokaraoke.h @@ -63,5 +63,7 @@ struct _GstAudioKaraokeClass GType gst_audio_karaoke_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audiokaraoke); + G_END_DECLS #endif /* __GST_AUDIO_KARAOKE_H__ */ diff --git a/gst/audiofx/audiopanorama.c b/gst/audiofx/audiopanorama.c index 31544e3893..3856a951ce 100644 --- a/gst/audiofx/audiopanorama.c +++ b/gst/audiofx/audiopanorama.c @@ -103,6 +103,8 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", ); G_DEFINE_TYPE (GstAudioPanorama, gst_audio_panorama, GST_TYPE_BASE_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE (audiopanorama, "audiopanorama", + GST_RANK_NONE, GST_TYPE_AUDIO_PANORAMA); static void gst_audio_panorama_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); diff --git a/gst/audiofx/audiopanorama.h b/gst/audiofx/audiopanorama.h index 44d1cec2b5..36a0633313 100644 --- a/gst/audiofx/audiopanorama.h +++ b/gst/audiofx/audiopanorama.h @@ -63,6 +63,8 @@ struct _GstAudioPanoramaClass { GType gst_audio_panorama_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audiopanorama); + G_END_DECLS #endif /* __GST_AUDIO_PANORAMA_H__ */ diff --git a/gst/audiofx/audiowsincband.c b/gst/audiofx/audiowsincband.c index 305673926c..8a512f7003 100644 --- a/gst/audiofx/audiowsincband.c +++ b/gst/audiofx/audiowsincband.c @@ -142,6 +142,8 @@ gst_gst_audio_wsincband_window_get_type (void) #define gst_audio_wsincband_parent_class parent_class G_DEFINE_TYPE (GstAudioWSincBand, gst_audio_wsincband, GST_TYPE_AUDIO_FX_BASE_FIR_FILTER); +GST_ELEMENT_REGISTER_DEFINE (audiowsincband, "audiowsincband", + GST_RANK_NONE, GST_TYPE_AUDIO_WSINC_BAND); static void gst_audio_wsincband_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); diff --git a/gst/audiofx/audiowsincband.h b/gst/audiofx/audiowsincband.h index 27c2bd479f..d7795f2f8c 100644 --- a/gst/audiofx/audiowsincband.h +++ b/gst/audiofx/audiowsincband.h @@ -75,6 +75,8 @@ struct _GstAudioWSincBandClass { GType gst_audio_wsincband_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audiowsincband); + G_END_DECLS #endif /* __GST_AUDIO_WSINC_BAND_H__ */ diff --git a/gst/audiofx/audiowsinclimit.c b/gst/audiofx/audiowsinclimit.c index 95c62be381..dd5a1dfbad 100644 --- a/gst/audiofx/audiowsinclimit.c +++ b/gst/audiofx/audiowsinclimit.c @@ -141,6 +141,8 @@ gst_audio_wsinclimit_window_get_type (void) #define gst_audio_wsinclimit_parent_class parent_class G_DEFINE_TYPE (GstAudioWSincLimit, gst_audio_wsinclimit, GST_TYPE_AUDIO_FX_BASE_FIR_FILTER); +GST_ELEMENT_REGISTER_DEFINE (audiowsinclimit, "audiowsinclimit", + GST_RANK_NONE, GST_TYPE_AUDIO_WSINC_LIMIT); static void gst_audio_wsinclimit_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); diff --git a/gst/audiofx/audiowsinclimit.h b/gst/audiofx/audiowsinclimit.h index e7fa915a0a..ffd24b57a9 100644 --- a/gst/audiofx/audiowsinclimit.h +++ b/gst/audiofx/audiowsinclimit.h @@ -75,6 +75,8 @@ struct _GstAudioWSincLimitClass { GType gst_audio_wsinclimit_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audiowsinclimit); + G_END_DECLS #endif /* __GST_AUDIO_WSINC_LIMIT_H__ */ diff --git a/gst/audiofx/gstscaletempo.c b/gst/audiofx/gstscaletempo.c index 276ec07b1f..646181fca8 100644 --- a/gst/audiofx/gstscaletempo.c +++ b/gst/audiofx/gstscaletempo.c @@ -112,6 +112,8 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", #define gst_scaletempo_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstScaletempo, gst_scaletempo, GST_TYPE_BASE_TRANSFORM, DEBUG_INIT (0)); +GST_ELEMENT_REGISTER_DEFINE (scaletempo, "scaletempo", + GST_RANK_NONE, GST_TYPE_SCALETEMPO); #define CREATE_BEST_OVERLAP_OFFSET_FLOAT_FUNC(type) \ static guint \ diff --git a/gst/audiofx/gstscaletempo.h b/gst/audiofx/gstscaletempo.h index 051881d5d9..02760fb6e3 100644 --- a/gst/audiofx/gstscaletempo.h +++ b/gst/audiofx/gstscaletempo.h @@ -95,5 +95,7 @@ struct _GstScaletempoClass GType gst_scaletempo_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (scaletempo); + G_END_DECLS #endif /* __GST_SCALETEMPO_H__ */ diff --git a/gst/audiofx/gststereo.c b/gst/audiofx/gststereo.c index 1a1ef75c49..fb299f1919 100644 --- a/gst/audiofx/gststereo.c +++ b/gst/audiofx/gststereo.c @@ -73,6 +73,7 @@ static GstFlowReturn gst_stereo_transform_ip (GstBaseTransform * base, GstBuffer * outbuf); G_DEFINE_TYPE (GstStereo, gst_stereo, GST_TYPE_AUDIO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (stereo, "stereo", GST_RANK_NONE, GST_TYPE_STEREO); static void gst_stereo_class_init (GstStereoClass * klass) diff --git a/gst/audiofx/gststereo.h b/gst/audiofx/gststereo.h index bd7b6c15b6..cf7757c5f3 100644 --- a/gst/audiofx/gststereo.h +++ b/gst/audiofx/gststereo.h @@ -52,4 +52,6 @@ struct _GstStereoClass { GType gst_stereo_get_type(void); +GST_ELEMENT_REGISTER_DECLARE (stereo); + #endif /* __GST_STEREO_H__ */