spandsp: allow per feature registration
authorStéphane Cerveau <scerveau@collabora.com>
Fri, 19 Feb 2021 11:54:56 +0000 (12:54 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 23 Mar 2021 14:19:17 +0000 (14:19 +0000)
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>

ext/spandsp/gstdtmfdetect.c
ext/spandsp/gstdtmfdetect.h
ext/spandsp/gstspandsp.c
ext/spandsp/gstspanplc.c
ext/spandsp/gstspanplc.h
ext/spandsp/gsttonegeneratesrc.c
ext/spandsp/gsttonegeneratesrc.h

index 6adf371..26a33f1 100644 (file)
@@ -93,6 +93,8 @@ static gboolean gst_dtmf_detect_sink_event (GstBaseTransform * trans,
     GstEvent * event);
 
 G_DEFINE_TYPE (GstDtmfDetect, gst_dtmf_detect, GST_TYPE_BASE_TRANSFORM);
+GST_ELEMENT_REGISTER_DEFINE (dtmfdetect, "dtmfdetect",
+    GST_RANK_MARGINAL, GST_TYPE_DTMF_DETECT);
 
 static void
 gst_dtmf_detect_class_init (GstDtmfDetectClass * klass)
@@ -278,11 +280,3 @@ gst_dtmf_detect_sink_event (GstBaseTransform * trans, GstEvent * event)
   return GST_BASE_TRANSFORM_CLASS (gst_dtmf_detect_parent_class)->sink_event
       (trans, event);
 }
-
-
-gboolean
-gst_dtmf_detect_plugin_init (GstPlugin * plugin)
-{
-  return gst_element_register (plugin, "dtmfdetect",
-      GST_RANK_MARGINAL, GST_TYPE_DTMF_DETECT);
-}
index e0de5c1..b8e8c98 100644 (file)
@@ -64,7 +64,7 @@ struct _GstDtmfDetectClass
 
 GType gst_dtmf_detect_get_type (void);
 
-gboolean gst_dtmf_detect_plugin_init (GstPlugin *plugin);
+GST_ELEMENT_REGISTER_DECLARE (dtmfdetect);
 
 G_END_DECLS
 
index 37a0806..0725bf0 100644 (file)
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
-  return gst_element_register (plugin, "spanplc",
-      GST_RANK_PRIMARY, GST_TYPE_SPAN_PLC) &&
-      gst_dtmf_detect_plugin_init (plugin) &&
-      gst_tone_generate_src_plugin_init (plugin);
+  gboolean ret = FALSE;
+
+  ret |= GST_ELEMENT_REGISTER (spanplc, plugin);
+  ret |= GST_ELEMENT_REGISTER (dtmfdetect, plugin);
+  ret |= GST_ELEMENT_REGISTER (tonegeneratesrc, plugin);
+
+  return ret;
 }
 
 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
index 602c6f0..f1e2949 100644 (file)
@@ -38,6 +38,8 @@
 #include <gst/audio/audio.h>
 
 G_DEFINE_TYPE (GstSpanPlc, gst_span_plc, GST_TYPE_ELEMENT);
+GST_ELEMENT_REGISTER_DEFINE (spanplc, "spanplc", GST_RANK_PRIMARY,
+    GST_TYPE_SPAN_PLC);
 
 GST_DEBUG_CATEGORY_STATIC (gst_span_plc_debug);
 #define GST_CAT_DEFAULT gst_span_plc_debug
index ae599ad..58f99bc 100644 (file)
@@ -59,6 +59,7 @@ struct _GstSpanPlcClass
 };
 
 GType gst_span_plc_get_type (void);
+GST_ELEMENT_REGISTER_DECLARE (spanplc);
 
 G_END_DECLS
 
index 341aeab..71d5cf2 100644 (file)
@@ -63,8 +63,13 @@ GST_STATIC_PAD_TEMPLATE ("src",
     );
 
 #define gst_tone_generate_src_parent_class parent_class
-G_DEFINE_TYPE (GstToneGenerateSrc, gst_tone_generate_src, GST_TYPE_PUSH_SRC);
+G_DEFINE_TYPE_WITH_CODE (GstToneGenerateSrc, gst_tone_generate_src,
+    GST_TYPE_PUSH_SRC, GST_DEBUG_CATEGORY_INIT (tone_generate_src_debug,
+        "tonegeneratesrc", 0, "Telephony Tone Test Source");
+    );
 
+GST_ELEMENT_REGISTER_DEFINE (tonegeneratesrc, "tonegeneratesrc", GST_RANK_NONE,
+    GST_TYPE_TONE_GENERATE_SRC);
 static void gst_tone_generate_src_finalize (GObject * object);
 static void gst_tone_generate_src_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
@@ -403,13 +408,3 @@ gst_tone_generate_src_get_property (GObject * object, guint prop_id,
       break;
   }
 }
-
-gboolean
-gst_tone_generate_src_plugin_init (GstPlugin * plugin)
-{
-  GST_DEBUG_CATEGORY_INIT (tone_generate_src_debug, "tonegeneratesrc", 0,
-      "Telephony Tone Test Source");
-
-  return gst_element_register (plugin, "tonegeneratesrc",
-      GST_RANK_NONE, GST_TYPE_TONE_GENERATE_SRC);
-}
index 200e13d..28b79f0 100644 (file)
@@ -82,7 +82,7 @@ struct _GstToneGenerateSrcClass {
 };
 
 GType gst_tone_generate_src_get_type (void);
-gboolean gst_tone_generate_src_plugin_init (GstPlugin *plugin);
+GST_ELEMENT_REGISTER_DECLARE (tonegeneratesrc);
 
 G_END_DECLS