openjpeg: allow per feature registration
authorStéphane Cerveau <scerveau@collabora.com>
Thu, 18 Feb 2021 14:30:06 +0000 (15:30 +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/openjpeg/gstopenjpeg.c
ext/openjpeg/gstopenjpegdec.c
ext/openjpeg/gstopenjpegdec.h
ext/openjpeg/gstopenjpegenc.c
ext/openjpeg/gstopenjpegenc.h

index 04a970b..98c6408 100644 (file)
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
-  if (!gst_element_register (plugin, "openjpegdec", GST_RANK_PRIMARY,
-          GST_TYPE_OPENJPEG_DEC))
-    return FALSE;
-  if (!gst_element_register (plugin, "openjpegenc", GST_RANK_PRIMARY,
-          GST_TYPE_OPENJPEG_ENC))
-    return FALSE;
+  gboolean ret = FALSE;
 
-  return TRUE;
+  ret |= GST_ELEMENT_REGISTER (openjpegdec, plugin);
+  ret |= GST_ELEMENT_REGISTER (openjpegenc, plugin);
+
+  return ret;
 }
 
 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
index 20dfeab..e8dd9ae 100644 (file)
@@ -83,6 +83,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
 
 #define parent_class gst_openjpeg_dec_parent_class
 G_DEFINE_TYPE (GstOpenJPEGDec, gst_openjpeg_dec, GST_TYPE_VIDEO_DECODER);
+GST_ELEMENT_REGISTER_DEFINE (openjpegdec, "openjpegdec",
+    GST_RANK_PRIMARY, GST_TYPE_OPENJPEG_DEC);
 
 static void
 gst_openjpeg_dec_class_init (GstOpenJPEGDecClass * klass)
index edb0617..8d5fd1a 100644 (file)
@@ -72,6 +72,8 @@ struct _GstOpenJPEGDecClass
 
 GType gst_openjpeg_dec_get_type (void);
 
+GST_ELEMENT_REGISTER_DECLARE (openjpegdec);
+
 G_END_DECLS
 
 #endif /* __GST_OPENJPEG_DEC_H__ */
index a758834..2bd5f82 100644 (file)
@@ -134,6 +134,8 @@ static GstStaticPadTemplate gst_openjpeg_enc_src_template =
 
 #define parent_class gst_openjpeg_enc_parent_class
 G_DEFINE_TYPE (GstOpenJPEGEnc, gst_openjpeg_enc, GST_TYPE_VIDEO_ENCODER);
+GST_ELEMENT_REGISTER_DEFINE (openjpegenc, "openjpegenc",
+    GST_RANK_PRIMARY, GST_TYPE_OPENJPEG_ENC);
 
 static void
 gst_openjpeg_enc_class_init (GstOpenJPEGEncClass * klass)
index c3393ee..754b3b4 100644 (file)
@@ -67,6 +67,8 @@ struct _GstOpenJPEGEncClass
 
 GType gst_openjpeg_enc_get_type (void);
 
+GST_ELEMENT_REGISTER_DECLARE (openjpegenc);
+
 G_END_DECLS
 
 #endif /* __GST_OPENJPEG_ENC_H__ */