theora: allow per feature registration
authorStéphane Cerveau <scerveau@collabora.com>
Fri, 11 Dec 2020 17:46:20 +0000 (18:46 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 16 Mar 2021 17:58:59 +0000 (17:58 +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-base/-/merge_requests/1029>

ext/theora/gsttheora.c
ext/theora/gsttheoradec.c
ext/theora/gsttheoradec.h
ext/theora/gsttheoraenc.c
ext/theora/gsttheoraenc.h
ext/theora/gsttheoraparse.c
ext/theora/gsttheoraparse.h

index 48096c5..3c7e2e0 100644 (file)
 
 #include <gst/gst.h>
 
-extern GType gst_theora_dec_get_type (void);
-extern GType gst_theora_enc_get_type (void);
-extern GType gst_theora_parse_get_type (void);
+#include "gsttheoradec.h"
+#include "gsttheoraenc.h"
+#include "gsttheoraparse.h"
 
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
-  if (!gst_element_register (plugin, "theoradec", GST_RANK_PRIMARY,
-          gst_theora_dec_get_type ()))
-    return FALSE;
+  gboolean ret = FALSE;
 
-  if (!gst_element_register (plugin, "theoraenc", GST_RANK_PRIMARY,
-          gst_theora_enc_get_type ()))
-    return FALSE;
+  ret |= GST_ELEMENT_REGISTER (theoradec, plugin);
+  ret |= GST_ELEMENT_REGISTER (theoraenc, plugin);
+  ret |= GST_ELEMENT_REGISTER (theoraparse, plugin);
 
-  if (!gst_element_register (plugin, "theoraparse", GST_RANK_NONE,
-          gst_theora_parse_get_type ()))
-    return FALSE;
-
-  return TRUE;
+  return ret;
 }
 
 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
index e76374a..0d61a01 100644 (file)
@@ -91,6 +91,8 @@ GST_STATIC_PAD_TEMPLATE ("sink",
 
 #define gst_theora_dec_parent_class parent_class
 G_DEFINE_TYPE (GstTheoraDec, gst_theora_dec, GST_TYPE_VIDEO_DECODER);
+GST_ELEMENT_REGISTER_DEFINE (theoradec, "theoradec",
+    GST_RANK_PRIMARY, GST_TYPE_THEORA_DEC);
 
 static void theora_dec_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
index bc97178..7689b76 100644 (file)
@@ -87,6 +87,8 @@ struct _GstTheoraDecClass
 
 GType gst_theora_dec_get_type (void);
 
+GST_ELEMENT_REGISTER_DECLARE (theoradec);
+
 G_END_DECLS
 
 #endif /* __GST_THEORADEC_H__ */
index ba16890..c531401 100644 (file)
@@ -176,6 +176,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
 
 #define gst_theora_enc_parent_class parent_class
 G_DEFINE_TYPE (GstTheoraEnc, gst_theora_enc, GST_TYPE_VIDEO_ENCODER);
+GST_ELEMENT_REGISTER_DEFINE (theoraenc, "theoraenc",
+    GST_RANK_PRIMARY, GST_TYPE_THEORA_ENC);
 
 static gboolean theora_enc_start (GstVideoEncoder * enc);
 static gboolean theora_enc_stop (GstVideoEncoder * enc);
index 0cbb73b..6c0e044 100644 (file)
@@ -113,6 +113,8 @@ struct _GstTheoraEncClass
 
 GType gst_theora_enc_get_type (void);
 
+GST_ELEMENT_REGISTER_DECLARE (theoraenc);
+
 G_END_DECLS
 
 #endif /* __GST_THEORAENC_H__ */
index b6f8a50..3ce2841 100644 (file)
@@ -91,6 +91,8 @@ enum
 
 #define gst_theora_parse_parent_class parent_class
 G_DEFINE_TYPE (GstTheoraParse, gst_theora_parse, GST_TYPE_ELEMENT);
+GST_ELEMENT_REGISTER_DEFINE (theoraparse, "theoraparse",
+    GST_RANK_NONE, GST_TYPE_THEORA_PARSE);
 
 static void theora_parse_dispose (GObject * object);
 
index 9ab1448..ff7ef26 100644 (file)
@@ -82,6 +82,8 @@ struct _GstTheoraParseClass {
 
 GType gst_theora_parse_get_type(void);
 
+GST_ELEMENT_REGISTER_DECLARE (theoraparse);
+
 G_END_DECLS
 
 #endif /* __GST_THEORA_PARSE_H__ */