webp: allow per feature registration
authorStéphane Cerveau <scerveau@collabora.com>
Thu, 25 Feb 2021 07:04:42 +0000 (08:04 +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/webp/gstwebp.c
ext/webp/gstwebpdec.c
ext/webp/gstwebpdec.h
ext/webp/gstwebpenc.c
ext/webp/gstwebpenc.h

index bd13e65..c296b19 100644 (file)
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
-  gst_webp_dec_register (plugin);
-  gst_webp_enc_register (plugin);
+  gboolean ret = FALSE;
 
-  return TRUE;
+  ret |= GST_ELEMENT_REGISTER (webpdec, plugin);
+  ret |= GST_ELEMENT_REGISTER (webpenc, plugin);
+
+  return ret;
 }
 
 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
index 2b9c246..a825083 100644 (file)
@@ -79,6 +79,8 @@ static gboolean gst_webp_dec_reset_frame (GstWebPDec * webpdec);
 
 #define gst_webp_dec_parent_class parent_class
 G_DEFINE_TYPE (GstWebPDec, gst_webp_dec, GST_TYPE_VIDEO_DECODER);
+GST_ELEMENT_REGISTER_DEFINE (webpdec, "webpdec",
+    GST_RANK_PRIMARY, GST_TYPE_WEBP_DEC);
 
 static void
 gst_webp_dec_class_init (GstWebPDecClass * klass)
@@ -489,10 +491,3 @@ gst_webp_dec_handle_frame (GstVideoDecoder * decoder,
 done:
   return ret;
 }
-
-gboolean
-gst_webp_dec_register (GstPlugin * plugin)
-{
-  return gst_element_register (plugin, "webpdec",
-      GST_RANK_PRIMARY, GST_TYPE_WEBP_DEC);
-}
index 6b89470..a9e76de 100644 (file)
@@ -69,7 +69,8 @@ struct _GstWebPDecClass {
 };
 
 GType gst_webp_dec_get_type (void);
-gboolean gst_webp_dec_register (GstPlugin * plugin);
+
+GST_ELEMENT_REGISTER_DECLARE (webpdec);
 
 G_END_DECLS
 
index edf236e..788215f 100644 (file)
@@ -107,6 +107,8 @@ gst_webp_enc_preset_get_type (void)
 
 #define gst_webp_enc_parent_class parent_class
 G_DEFINE_TYPE (GstWebpEnc, gst_webp_enc, GST_TYPE_VIDEO_ENCODER);
+GST_ELEMENT_REGISTER_DEFINE (webpenc, "webpenc",
+    GST_RANK_PRIMARY, GST_TYPE_WEBP_ENC);
 
 static void
 gst_webp_enc_class_init (GstWebpEncClass * klass)
@@ -398,10 +400,3 @@ gst_webp_enc_stop (GstVideoEncoder * benc)
     gst_video_codec_state_unref (enc->input_state);
   return TRUE;
 }
-
-gboolean
-gst_webp_enc_register (GstPlugin * plugin)
-{
-  return gst_element_register (plugin, "webpenc",
-      GST_RANK_PRIMARY, GST_TYPE_WEBP_ENC);
-}
index be1d11c..b0bbb30 100644 (file)
@@ -70,7 +70,8 @@ struct _GstWebpEncClass
 };
 
 GType gst_webp_enc_get_type (void);
-gboolean gst_webp_enc_register (GstPlugin * plugin);
+
+GST_ELEMENT_REGISTER_DECLARE (webpenc);
 
 G_END_DECLS
 #endif /* __GST_WEBPENC_H__ */