From 48786371df37ed1e90e225b9d96a81ef7d72760f Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Cerveau?= Date: Wed, 17 Feb 2021 08:52:40 +0100 Subject: [PATCH] twolame: 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: --- ext/twolame/gsttwolamemp2enc.c | 16 ++++++++++------ ext/twolame/gsttwolamemp2enc.h | 2 ++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ext/twolame/gsttwolamemp2enc.c b/ext/twolame/gsttwolamemp2enc.c index 5757210..1fc7f09 100644 --- a/ext/twolame/gsttwolamemp2enc.c +++ b/ext/twolame/gsttwolamemp2enc.c @@ -201,8 +201,11 @@ static void gst_two_lame_set_property (GObject * object, guint prop_id, static void gst_two_lame_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static gboolean gst_two_lame_setup (GstTwoLame * twolame); +static gboolean two_lame_element_init (void); G_DEFINE_TYPE (GstTwoLame, gst_two_lame, GST_TYPE_AUDIO_ENCODER); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (twolamemp2enc, "twolamemp2enc", + GST_RANK_PRIMARY, GST_TYPE_TWO_LAME, two_lame_element_init ();); static void gst_two_lame_release_memory (GstTwoLame * twolame) @@ -868,7 +871,7 @@ gst_two_lame_get_default_settings (void) } static gboolean -plugin_init (GstPlugin * plugin) +two_lame_element_init (void) { GST_DEBUG_CATEGORY_INIT (debug, "twolame", 0, "twolame mp2 encoder"); @@ -881,14 +884,15 @@ plugin_init (GstPlugin * plugin) bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); #endif /* ENABLE_NLS */ - - if (!gst_element_register (plugin, "twolamemp2enc", GST_RANK_PRIMARY, - GST_TYPE_TWO_LAME)) - return FALSE; - return TRUE; } +static gboolean +plugin_init (GstPlugin * plugin) +{ + return GST_ELEMENT_REGISTER (twolamemp2enc, plugin); +} + GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, twolame, diff --git a/ext/twolame/gsttwolamemp2enc.h b/ext/twolame/gsttwolamemp2enc.h index 2a02ca6..191d40d 100644 --- a/ext/twolame/gsttwolamemp2enc.h +++ b/ext/twolame/gsttwolamemp2enc.h @@ -65,6 +65,8 @@ struct _GstTwoLame { twolame_options *glopts; }; +GST_ELEMENT_REGISTER_DECLARE (twolamemp2enc); + G_END_DECLS -- 2.7.4