spandsp: 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-bad/-/merge_requests/2038>
This commit is contained in:
Stéphane Cerveau 2021-02-19 12:54:56 +01:00 committed by GStreamer Marge Bot
parent c8ef250fe2
commit 27ab8f8bce
7 changed files with 20 additions and 25 deletions

View file

@ -93,6 +93,8 @@ static gboolean gst_dtmf_detect_sink_event (GstBaseTransform * trans,
GstEvent * event); GstEvent * event);
G_DEFINE_TYPE (GstDtmfDetect, gst_dtmf_detect, GST_TYPE_BASE_TRANSFORM); 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 static void
gst_dtmf_detect_class_init (GstDtmfDetectClass * klass) 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 return GST_BASE_TRANSFORM_CLASS (gst_dtmf_detect_parent_class)->sink_event
(trans, event); (trans, event);
} }
gboolean
gst_dtmf_detect_plugin_init (GstPlugin * plugin)
{
return gst_element_register (plugin, "dtmfdetect",
GST_RANK_MARGINAL, GST_TYPE_DTMF_DETECT);
}

View file

@ -64,7 +64,7 @@ struct _GstDtmfDetectClass
GType gst_dtmf_detect_get_type (void); GType gst_dtmf_detect_get_type (void);
gboolean gst_dtmf_detect_plugin_init (GstPlugin *plugin); GST_ELEMENT_REGISTER_DECLARE (dtmfdetect);
G_END_DECLS G_END_DECLS

View file

@ -31,10 +31,13 @@
static gboolean static gboolean
plugin_init (GstPlugin * plugin) plugin_init (GstPlugin * plugin)
{ {
return gst_element_register (plugin, "spanplc", gboolean ret = FALSE;
GST_RANK_PRIMARY, GST_TYPE_SPAN_PLC) &&
gst_dtmf_detect_plugin_init (plugin) && ret |= GST_ELEMENT_REGISTER (spanplc, plugin);
gst_tone_generate_src_plugin_init (plugin); ret |= GST_ELEMENT_REGISTER (dtmfdetect, plugin);
ret |= GST_ELEMENT_REGISTER (tonegeneratesrc, plugin);
return ret;
} }
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,

View file

@ -38,6 +38,8 @@
#include <gst/audio/audio.h> #include <gst/audio/audio.h>
G_DEFINE_TYPE (GstSpanPlc, gst_span_plc, GST_TYPE_ELEMENT); 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); GST_DEBUG_CATEGORY_STATIC (gst_span_plc_debug);
#define GST_CAT_DEFAULT gst_span_plc_debug #define GST_CAT_DEFAULT gst_span_plc_debug

View file

@ -59,6 +59,7 @@ struct _GstSpanPlcClass
}; };
GType gst_span_plc_get_type (void); GType gst_span_plc_get_type (void);
GST_ELEMENT_REGISTER_DECLARE (spanplc);
G_END_DECLS G_END_DECLS

View file

@ -63,8 +63,13 @@ GST_STATIC_PAD_TEMPLATE ("src",
); );
#define gst_tone_generate_src_parent_class parent_class #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_finalize (GObject * object);
static void gst_tone_generate_src_set_property (GObject * object, guint prop_id, static void gst_tone_generate_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
@ -403,13 +408,3 @@ gst_tone_generate_src_get_property (GObject * object, guint prop_id,
break; 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);
}

View file

@ -82,7 +82,7 @@ struct _GstToneGenerateSrcClass {
}; };
GType gst_tone_generate_src_get_type (void); 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 G_END_DECLS