twolame: allow per feature registration
authorStéphane Cerveau <scerveau@collabora.com>
Wed, 17 Feb 2021 07:52:40 +0000 (08:52 +0100)
committerStéphane Cerveau <scerveau@collabora.com>
Mon, 29 Mar 2021 10:45:23 +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>

ext/twolame/gsttwolamemp2enc.c
ext/twolame/gsttwolamemp2enc.h

index 5757210..1fc7f09 100644 (file)
@@ -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,
index 2a02ca6..191d40d 100644 (file)
@@ -65,6 +65,8 @@ struct _GstTwoLame {
   twolame_options *glopts;
 };
 
+GST_ELEMENT_REGISTER_DECLARE (twolamemp2enc);
+
 G_END_DECLS