From e4d26e69d3f68a5ca2f93092dc3589af0fcf9336 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Cerveau?= Date: Fri, 12 Feb 2021 08:48:21 +0100 Subject: [PATCH] gtk: 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/gtk/gstgtkglsink.c | 3 +++ ext/gtk/gstgtkglsink.h | 2 ++ ext/gtk/gstgtksink.c | 2 ++ ext/gtk/gstgtksink.h | 2 ++ ext/gtk/gstplugin.c | 15 ++++++--------- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ext/gtk/gstgtkglsink.c b/ext/gtk/gstgtkglsink.c index 1102d47..18923f5 100644 --- a/ext/gtk/gstgtkglsink.c +++ b/ext/gtk/gstgtkglsink.c @@ -59,6 +59,9 @@ static GstStaticPadTemplate gst_gtk_gl_sink_template = G_DEFINE_TYPE_WITH_CODE (GstGtkGLSink, gst_gtk_gl_sink, GST_TYPE_GTK_BASE_SINK, GST_DEBUG_CATEGORY_INIT (gst_debug_gtk_gl_sink, "gtkglsink", 0, "Gtk GL Video Sink")); +GST_ELEMENT_REGISTER_DEFINE (gtkglsink, "gtkglsink", GST_RANK_NONE, + GST_TYPE_GTK_GL_SINK); + static void gst_gtk_gl_sink_class_init (GstGtkGLSinkClass * klass) diff --git a/ext/gtk/gstgtkglsink.h b/ext/gtk/gstgtkglsink.h index 8ff9359..423e212 100644 --- a/ext/gtk/gstgtkglsink.h +++ b/ext/gtk/gstgtkglsink.h @@ -61,6 +61,8 @@ struct _GstGtkGLSink gulong widget_destroy_sig_handler; }; +GST_ELEMENT_REGISTER_DECLARE (gtkglsink); + G_END_DECLS #endif /* __GST_GTK_GL_SINK_H__ */ diff --git a/ext/gtk/gstgtksink.c b/ext/gtk/gstgtksink.c index ba8ea33..c8ae3c7 100644 --- a/ext/gtk/gstgtksink.c +++ b/ext/gtk/gstgtksink.c @@ -51,6 +51,8 @@ GST_STATIC_PAD_TEMPLATE ("sink", G_DEFINE_TYPE_WITH_CODE (GstGtkSink, gst_gtk_sink, GST_TYPE_GTK_BASE_SINK, GST_DEBUG_CATEGORY_INIT (gst_debug_gtk_sink, "gtksink", 0, "Gtk Video Sink")); +GST_ELEMENT_REGISTER_DEFINE (gtksink, "gtksink", GST_RANK_NONE, + GST_TYPE_GTK_SINK); static void gst_gtk_sink_class_init (GstGtkSinkClass * klass) diff --git a/ext/gtk/gstgtksink.h b/ext/gtk/gstgtksink.h index fcc5b97..240eed2 100644 --- a/ext/gtk/gstgtksink.h +++ b/ext/gtk/gstgtksink.h @@ -44,6 +44,8 @@ struct _GstGtkSink GstGtkBaseSink parent; }; +GST_ELEMENT_REGISTER_DECLARE (gtksink); + G_END_DECLS #endif /* __GST_GTK_SINK_H__ */ diff --git a/ext/gtk/gstplugin.c b/ext/gtk/gstplugin.c index ed27578..dd90ac9 100644 --- a/ext/gtk/gstplugin.c +++ b/ext/gtk/gstplugin.c @@ -30,18 +30,15 @@ static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "gtksink", - GST_RANK_NONE, GST_TYPE_GTK_SINK)) { - return FALSE; - } + gboolean ret = FALSE; + + ret |= GST_ELEMENT_REGISTER (gtksink, plugin); + #if defined(HAVE_GTK3_GL) - if (!gst_element_register (plugin, "gtkglsink", - GST_RANK_NONE, GST_TYPE_GTK_GL_SINK)) { - return FALSE; - } + ret |= GST_ELEMENT_REGISTER (gtkglsink, plugin); #endif - return TRUE; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, -- 2.7.4