From 4d6a69c6554dff1c1131a0304fa3006ad437640e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Mon, 15 Feb 2021 15:37:52 +0100 Subject: [PATCH] effectv: allow per feature registration 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: --- gst/effectv/gstaging.c | 2 ++ gst/effectv/gstdice.c | 1 + gst/effectv/gstedge.c | 2 ++ gst/effectv/gsteffectv.c | 44 ++++++++++++------------------------- gst/effectv/gsteffectv.h | 13 +++++++++++ gst/effectv/gstop.c | 1 + gst/effectv/gstquark.c | 2 ++ gst/effectv/gstradioac.c | 2 ++ gst/effectv/gstrev.c | 3 +++ gst/effectv/gstripple.c | 2 ++ gst/effectv/gstshagadelic.c | 2 ++ gst/effectv/gststreak.c | 2 ++ gst/effectv/gstvertigo.c | 3 +++ gst/effectv/gstwarp.c | 2 ++ 14 files changed, 51 insertions(+), 30 deletions(-) diff --git a/gst/effectv/gstaging.c b/gst/effectv/gstaging.c index d6d28a3a86..2b36d68197 100644 --- a/gst/effectv/gstaging.c +++ b/gst/effectv/gstaging.c @@ -86,6 +86,8 @@ GST_STATIC_PAD_TEMPLATE ("sink", ); G_DEFINE_TYPE (GstAgingTV, gst_agingtv, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (agingtv, "agingtv", GST_RANK_NONE, + GST_TYPE_AGINGTV); static void coloraging (guint32 * src, guint32 * dest, gint video_area, gint * c) diff --git a/gst/effectv/gstdice.c b/gst/effectv/gstdice.c index e6acd94586..e7929fbeae 100644 --- a/gst/effectv/gstdice.c +++ b/gst/effectv/gstdice.c @@ -67,6 +67,7 @@ typedef enum _dice_dir #define gst_dicetv_parent_class parent_class G_DEFINE_TYPE (GstDiceTV, gst_dicetv, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (dicetv, "dicetv", GST_RANK_NONE, GST_TYPE_DICETV); static void gst_dicetv_create_map (GstDiceTV * filter, GstVideoInfo * info); diff --git a/gst/effectv/gstedge.c b/gst/effectv/gstedge.c index 6bb1702f5b..3e6a9de8b6 100644 --- a/gst/effectv/gstedge.c +++ b/gst/effectv/gstedge.c @@ -45,9 +45,11 @@ #include #include "gstedge.h" +#include "gsteffectv.h" #define gst_edgetv_parent_class parent_class G_DEFINE_TYPE (GstEdgeTV, gst_edgetv, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (edgetv, "edgetv", GST_RANK_NONE, GST_TYPE_EDGETV); #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define CAPS_STR GST_VIDEO_CAPS_MAKE ("{ BGRx, RGBx }") diff --git a/gst/effectv/gsteffectv.c b/gst/effectv/gsteffectv.c index 0e9ffc05a3..57f1a755ce 100644 --- a/gst/effectv/gsteffectv.c +++ b/gst/effectv/gsteffectv.c @@ -39,41 +39,25 @@ #include "gststreak.h" #include "gstripple.h" -struct _elements_entry -{ - const gchar *name; - GType (*type) (void); -}; - -static const struct _elements_entry _elements[] = { - {"edgetv", gst_edgetv_get_type}, - {"agingtv", gst_agingtv_get_type}, - {"dicetv", gst_dicetv_get_type}, - {"warptv", gst_warptv_get_type}, - {"shagadelictv", gst_shagadelictv_get_type}, - {"vertigotv", gst_vertigotv_get_type}, - {"revtv", gst_revtv_get_type}, - {"quarktv", gst_quarktv_get_type}, - {"optv", gst_optv_get_type}, - {"radioactv", gst_radioactv_get_type}, - {"streaktv", gst_streaktv_get_type}, - {"rippletv", gst_rippletv_get_type}, - {NULL, 0}, -}; - static gboolean plugin_init (GstPlugin * plugin) { - gint i = 0; + gboolean ret = FALSE; - while (_elements[i].name) { - if (!gst_element_register (plugin, _elements[i].name, - GST_RANK_NONE, (_elements[i].type) ())) - return FALSE; - i++; - } + ret |= GST_ELEMENT_REGISTER (edgetv, plugin); + ret |= GST_ELEMENT_REGISTER (agingtv, plugin); + ret |= GST_ELEMENT_REGISTER (dicetv, plugin); + ret |= GST_ELEMENT_REGISTER (warptv, plugin); + ret |= GST_ELEMENT_REGISTER (shagadelictv, plugin); + ret |= GST_ELEMENT_REGISTER (vertigotv, plugin); + ret |= GST_ELEMENT_REGISTER (revtv, plugin); + ret |= GST_ELEMENT_REGISTER (quarktv, plugin); + ret |= GST_ELEMENT_REGISTER (optv, plugin); + ret |= GST_ELEMENT_REGISTER (radioactv, plugin); + ret |= GST_ELEMENT_REGISTER (streaktv, plugin); + ret |= GST_ELEMENT_REGISTER (rippletv, plugin); - return TRUE; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/effectv/gsteffectv.h b/gst/effectv/gsteffectv.h index 0f00799a54..311e4a156b 100644 --- a/gst/effectv/gsteffectv.h +++ b/gst/effectv/gsteffectv.h @@ -23,6 +23,19 @@ #include +GST_ELEMENT_REGISTER_DECLARE (edgetv); +GST_ELEMENT_REGISTER_DECLARE (agingtv); +GST_ELEMENT_REGISTER_DECLARE (dicetv); +GST_ELEMENT_REGISTER_DECLARE (warptv); +GST_ELEMENT_REGISTER_DECLARE (shagadelictv); +GST_ELEMENT_REGISTER_DECLARE (vertigotv); +GST_ELEMENT_REGISTER_DECLARE (revtv); +GST_ELEMENT_REGISTER_DECLARE (quarktv); +GST_ELEMENT_REGISTER_DECLARE (optv); +GST_ELEMENT_REGISTER_DECLARE (radioactv); +GST_ELEMENT_REGISTER_DECLARE (streaktv); +GST_ELEMENT_REGISTER_DECLARE (rippletv); + static inline guint fastrand (void) { diff --git a/gst/effectv/gstop.c b/gst/effectv/gstop.c index 498b89a7a7..b40c893c7a 100644 --- a/gst/effectv/gstop.c +++ b/gst/effectv/gstop.c @@ -96,6 +96,7 @@ static guint32 palette[256]; #define gst_optv_parent_class parent_class G_DEFINE_TYPE (GstOpTV, gst_optv, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (optv, "optv", GST_RANK_NONE, gst_optv_get_type ()); #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define CAPS_STR GST_VIDEO_CAPS_MAKE ("{ BGRx, RGBx }") diff --git a/gst/effectv/gstquark.c b/gst/effectv/gstquark.c index 930c355665..5d0536867e 100644 --- a/gst/effectv/gstquark.c +++ b/gst/effectv/gstquark.c @@ -60,6 +60,8 @@ enum #define gst_quarktv_parent_class parent_class G_DEFINE_TYPE (GstQuarkTV, gst_quarktv, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (quarktv, "quarktv", GST_RANK_NONE, + GST_TYPE_QUARKTV); static void gst_quarktv_planetable_clear (GstQuarkTV * filter); diff --git a/gst/effectv/gstradioac.c b/gst/effectv/gstradioac.c index 0d674008d0..34496aa12e 100644 --- a/gst/effectv/gstradioac.c +++ b/gst/effectv/gstradioac.c @@ -135,6 +135,8 @@ static const gint swap_tab[] = { 2, 1, 0, 3 }; #define gst_radioactv_parent_class parent_class G_DEFINE_TYPE (GstRadioacTV, gst_radioactv, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (radioactv, "radioactv", GST_RANK_NONE, + GST_TYPE_RADIOACTV); #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define CAPS_STR GST_VIDEO_CAPS_MAKE ("{ RGBx, BGRx }") diff --git a/gst/effectv/gstrev.c b/gst/effectv/gstrev.c index 59c2e36f9a..3ea55cf789 100644 --- a/gst/effectv/gstrev.c +++ b/gst/effectv/gstrev.c @@ -62,6 +62,7 @@ #include #include +#include "gsteffectv.h" #include "gstrev.h" #define THE_COLOR 0xffffffff @@ -76,6 +77,8 @@ enum #define gst_revtv_parent_class parent_class G_DEFINE_TYPE (GstRevTV, gst_revtv, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (revtv, "revtv", GST_RANK_NONE, + gst_revtv_get_type ()); #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define CAPS_STR GST_VIDEO_CAPS_MAKE ("{ BGRx, RGBx }") diff --git a/gst/effectv/gstripple.c b/gst/effectv/gstripple.c index 2b15d03689..1425b2b360 100644 --- a/gst/effectv/gstripple.c +++ b/gst/effectv/gstripple.c @@ -83,6 +83,8 @@ gst_rippletv_mode_get_type (void) #define gst_rippletv_parent_class parent_class G_DEFINE_TYPE (GstRippleTV, gst_rippletv, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (rippletv, "rippletv", GST_RANK_NONE, + GST_TYPE_RIPPLETV); static GstStaticPadTemplate gst_rippletv_src_template = GST_STATIC_PAD_TEMPLATE ("src", diff --git a/gst/effectv/gstshagadelic.c b/gst/effectv/gstshagadelic.c index e220234efd..767aa64958 100644 --- a/gst/effectv/gstshagadelic.c +++ b/gst/effectv/gstshagadelic.c @@ -51,6 +51,8 @@ #define gst_shagadelictv_parent_class parent_class G_DEFINE_TYPE (GstShagadelicTV, gst_shagadelictv, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (shagadelictv, "shagadelictv", + GST_RANK_NONE, GST_TYPE_SHAGADELICTV); static void gst_shagadelic_initialize (GstShagadelicTV * filter, GstVideoInfo * in_info); diff --git a/gst/effectv/gststreak.c b/gst/effectv/gststreak.c index 312dccad1f..e34eb20632 100644 --- a/gst/effectv/gststreak.c +++ b/gst/effectv/gststreak.c @@ -61,6 +61,8 @@ enum #define gst_streaktv_parent_class parent_class G_DEFINE_TYPE (GstStreakTV, gst_streaktv, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (streaktv, "streaktv", GST_RANK_NONE, + GST_TYPE_STREAKTV); static GstStaticPadTemplate gst_streaktv_src_template = GST_STATIC_PAD_TEMPLATE ("src", diff --git a/gst/effectv/gstvertigo.c b/gst/effectv/gstvertigo.c index ac047fe2a9..2be7fd58e2 100644 --- a/gst/effectv/gstvertigo.c +++ b/gst/effectv/gstvertigo.c @@ -41,10 +41,13 @@ #include #include +#include "gsteffectv.h" #include "gstvertigo.h" #define gst_vertigotv_parent_class parent_class G_DEFINE_TYPE (GstVertigoTV, gst_vertigotv, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (vertigotv, "vertigotv", GST_RANK_NONE, + GST_TYPE_VERTIGOTV); /* Filter signals and args */ enum diff --git a/gst/effectv/gstwarp.c b/gst/effectv/gstwarp.c index 651fcd74db..2915b4270d 100644 --- a/gst/effectv/gstwarp.c +++ b/gst/effectv/gstwarp.c @@ -50,6 +50,7 @@ #include "config.h" #endif +#include "gsteffectv.h" #include #include @@ -63,6 +64,7 @@ #define gst_warptv_parent_class parent_class G_DEFINE_TYPE (GstWarpTV, gst_warptv, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (warptv, "warptv", GST_RANK_NONE, GST_TYPE_WARPTV); static void initSinTable (); static void initDistTable (GstWarpTV * filter, gint width, gint height);