libpng: allow per feature registration
authorStéphane Cerveau <scerveau@collabora.com>
Fri, 12 Feb 2021 09:33:50 +0000 (10:33 +0100)
committerStéphane Cerveau <scerveau@collabora.com>
Mon, 29 Mar 2021 10:45:21 +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/libpng/gstpng.c
ext/libpng/gstpngdec.c
ext/libpng/gstpngdec.h
ext/libpng/gstpngenc.c
ext/libpng/gstpngenc.h

index 92ff479..8220766 100644 (file)
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
-  if (!gst_element_register (plugin, "pngdec", GST_RANK_PRIMARY,
-          GST_TYPE_PNGDEC))
-    return FALSE;
+  gboolean ret = FALSE;
 
-  if (!gst_element_register (plugin, "pngenc", GST_RANK_PRIMARY,
-          GST_TYPE_PNGENC))
-    return FALSE;
+  ret |= GST_ELEMENT_REGISTER (pngdec, plugin);
+  ret |= GST_ELEMENT_REGISTER (pngenc, plugin);
 
-  return TRUE;
+  return ret;
 }
 
 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
index 4592fef..804932d 100644 (file)
@@ -62,6 +62,8 @@ static gboolean gst_pngdec_sink_event (GstVideoDecoder * bdec,
 
 #define parent_class gst_pngdec_parent_class
 G_DEFINE_TYPE (GstPngDec, gst_pngdec, GST_TYPE_VIDEO_DECODER);
+GST_ELEMENT_REGISTER_DEFINE (pngdec, "pngdec", GST_RANK_PRIMARY,
+    GST_TYPE_PNGDEC);
 
 static GstStaticPadTemplate gst_pngdec_src_pad_template =
 GST_STATIC_PAD_TEMPLATE ("src",
index eccdf3e..4a8a6f2 100644 (file)
@@ -53,6 +53,8 @@ struct _GstPngDec
   gsize read_data;
 };
 
+GST_ELEMENT_REGISTER_DECLARE (pngdec);
+
 G_END_DECLS
 
 #endif /* __GST_PNGDEC_H__ */
index bb0c5cb..25f3714 100644 (file)
@@ -74,6 +74,8 @@ GST_STATIC_PAD_TEMPLATE ("sink",
 
 #define parent_class gst_pngenc_parent_class
 G_DEFINE_TYPE (GstPngEnc, gst_pngenc, GST_TYPE_VIDEO_ENCODER);
+GST_ELEMENT_REGISTER_DEFINE (pngenc, "pngenc", GST_RANK_PRIMARY,
+    GST_TYPE_PNGENC);
 
 static void gst_pngenc_set_property (GObject * object,
     guint prop_id, const GValue * value, GParamSpec * pspec);
index f068d68..878038c 100644 (file)
@@ -50,6 +50,8 @@ struct _GstPngEnc
   gboolean newmedia;
 };
 
+GST_ELEMENT_REGISTER_DECLARE (pngenc);
+
 G_END_DECLS
 
 #endif /* __GST_PNGENC_H__ */