dtmf: allow per feature registration
authorStéphane Cerveau <scerveau@collabora.com>
Mon, 15 Feb 2021 14:03:10 +0000 (15:03 +0100)
committerStéphane Cerveau <scerveau@collabora.com>
Mon, 29 Mar 2021 10:45:22 +0000 (12:45 +0200)
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>

gst/dtmf/gstdtmf.c
gst/dtmf/gstdtmfsrc.c
gst/dtmf/gstdtmfsrc.h
gst/dtmf/gstrtpdtmfdepay.c
gst/dtmf/gstrtpdtmfdepay.h
gst/dtmf/gstrtpdtmfsrc.c
gst/dtmf/gstrtpdtmfsrc.h

index 1dc4001..bde66ae 100644 (file)
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
-  if (!gst_dtmf_src_plugin_init (plugin))
-    return FALSE;
+  gboolean ret = FALSE;
 
-  if (!gst_rtp_dtmf_src_plugin_init (plugin))
-    return FALSE;
+  ret |= GST_ELEMENT_REGISTER (dtmfsrc, plugin);
+  ret |= GST_ELEMENT_REGISTER (rtpdtmfsrc, plugin);
+  ret |= GST_ELEMENT_REGISTER (rtpdtmfdepay, plugin);
 
-  if (!gst_rtp_dtmf_depay_plugin_init (plugin))
-    return FALSE;
-
-  return TRUE;
+  return ret;
 }
 
 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
index 500d6d3..1945c0f 100644 (file)
@@ -173,6 +173,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
 
 #define parent_class gst_dtmf_src_parent_class
 G_DEFINE_TYPE (GstDTMFSrc, gst_dtmf_src, GST_TYPE_BASE_SRC);
+GST_ELEMENT_REGISTER_DEFINE (dtmfsrc, "dtmfsrc", GST_RANK_NONE,
+    GST_TYPE_DTMF_SRC);
 
 static void gst_dtmf_src_finalize (GObject * object);
 
@@ -949,10 +951,3 @@ failure:
     return result;
   }
 }
-
-gboolean
-gst_dtmf_src_plugin_init (GstPlugin * plugin)
-{
-  return gst_element_register (plugin, "dtmfsrc",
-      GST_RANK_NONE, GST_TYPE_DTMF_SRC);
-}
index 04440bc..996d926 100644 (file)
@@ -95,7 +95,7 @@ struct _GstDTMFSrcClass
 
 GType gst_dtmf_src_get_type (void);
 
-gboolean gst_dtmf_src_plugin_init (GstPlugin * plugin);
+GST_ELEMENT_REGISTER_DECLARE (dtmfsrc);
 
 G_END_DECLS
 #endif /* __GST_DTMF_SRC_H__ */
index 8fd6612..d7c5433 100644 (file)
@@ -155,6 +155,8 @@ GST_STATIC_PAD_TEMPLATE ("sink",
 
 G_DEFINE_TYPE (GstRtpDTMFDepay, gst_rtp_dtmf_depay,
     GST_TYPE_RTP_BASE_DEPAYLOAD);
+GST_ELEMENT_REGISTER_DEFINE (rtpdtmfdepay, "rtpdtmfdepay", GST_RANK_MARGINAL,
+    GST_TYPE_RTP_DTMF_DEPAY);
 
 static void gst_rtp_dtmf_depay_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
@@ -489,10 +491,3 @@ bad_packet:
 
   return NULL;
 }
-
-gboolean
-gst_rtp_dtmf_depay_plugin_init (GstPlugin * plugin)
-{
-  return gst_element_register (plugin, "rtpdtmfdepay",
-      GST_RANK_MARGINAL, GST_TYPE_RTP_DTMF_DEPAY);
-}
index c5ed189..8b7aec6 100644 (file)
@@ -62,7 +62,7 @@ struct _GstRtpDTMFDepayClass
 
 GType gst_rtp_dtmf_depay_get_type (void);
 
-gboolean gst_rtp_dtmf_depay_plugin_init (GstPlugin * plugin);
+GST_ELEMENT_REGISTER_DECLARE (rtpdtmfdepay);
 
 G_END_DECLS
 #endif /* __GST_RTP_DTMF_DEPAY_H__ */
index 91e386f..5cfbdcf 100644 (file)
@@ -135,6 +135,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
 
 
 G_DEFINE_TYPE (GstRTPDTMFSrc, gst_rtp_dtmf_src, GST_TYPE_BASE_SRC);
+GST_ELEMENT_REGISTER_DEFINE (rtpdtmfsrc, "rtpdtmfsrc", GST_RANK_NONE,
+    GST_TYPE_RTP_DTMF_SRC);
 
 static void gst_rtp_dtmf_src_finalize (GObject * object);
 
@@ -1137,10 +1139,3 @@ gst_rtp_dtmf_src_unlock_stop (GstBaseSrc * src)
 
   return TRUE;
 }
-
-gboolean
-gst_rtp_dtmf_src_plugin_init (GstPlugin * plugin)
-{
-  return gst_element_register (plugin, "rtpdtmfsrc",
-      GST_RANK_NONE, GST_TYPE_RTP_DTMF_SRC);
-}
index 3e9256c..b694b01 100644 (file)
@@ -108,8 +108,7 @@ struct _GstRTPDTMFSrcClass
 
 GType gst_rtp_dtmf_src_get_type (void);
 
-gboolean gst_rtp_dtmf_src_plugin_init (GstPlugin * plugin);
-
+GST_ELEMENT_REGISTER_DECLARE (rtpdtmfsrc);
 
 G_END_DECLS
 #endif /* __GST_RTP_DTMF_SRC_H__ */