From 6adf7dff71b2808e8b5fbef7bf45f1ae50ae1b34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Thu, 25 Feb 2021 08:04:42 +0100 Subject: [PATCH] webp: 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: --- ext/webp/gstwebp.c | 8 +++++--- ext/webp/gstwebpdec.c | 9 ++------- ext/webp/gstwebpdec.h | 3 ++- ext/webp/gstwebpenc.c | 9 ++------- ext/webp/gstwebpenc.h | 3 ++- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/ext/webp/gstwebp.c b/ext/webp/gstwebp.c index bd13e65e5c..c296b19326 100644 --- a/ext/webp/gstwebp.c +++ b/ext/webp/gstwebp.c @@ -31,10 +31,12 @@ 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, diff --git a/ext/webp/gstwebpdec.c b/ext/webp/gstwebpdec.c index 2b9c2466ee..a82508308d 100644 --- a/ext/webp/gstwebpdec.c +++ b/ext/webp/gstwebpdec.c @@ -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); -} diff --git a/ext/webp/gstwebpdec.h b/ext/webp/gstwebpdec.h index 6b89470c10..a9e76de4f7 100644 --- a/ext/webp/gstwebpdec.h +++ b/ext/webp/gstwebpdec.h @@ -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 diff --git a/ext/webp/gstwebpenc.c b/ext/webp/gstwebpenc.c index edf236e278..788215f8dd 100644 --- a/ext/webp/gstwebpenc.c +++ b/ext/webp/gstwebpenc.c @@ -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); -} diff --git a/ext/webp/gstwebpenc.h b/ext/webp/gstwebpenc.h index be1d11ccad..b0bbb3036d 100644 --- a/ext/webp/gstwebpenc.h +++ b/ext/webp/gstwebpenc.h @@ -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__ */