From fa416b08b70f39fc702034554022b390383be72e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Mon, 29 Mar 2021 14:09:16 +0200 Subject: [PATCH] ximage: 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: --- sys/ximage/ximage.c | 16 +--------------- sys/ximage/ximagepool.c | 2 +- sys/ximage/ximagesink.c | 13 +++++++++++-- sys/ximage/ximagesink.h | 1 + 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/sys/ximage/ximage.c b/sys/ximage/ximage.c index 4ccaa7fbd7..0a48c8926b 100644 --- a/sys/ximage/ximage.c +++ b/sys/ximage/ximage.c @@ -23,25 +23,11 @@ #include "ximagesink.h" -GST_DEBUG_CATEGORY (gst_debug_x_image_pool); -GST_DEBUG_CATEGORY (gst_debug_x_image_sink); -GST_DEBUG_CATEGORY (CAT_PERFORMANCE); static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "ximagesink", - GST_RANK_SECONDARY, GST_TYPE_X_IMAGE_SINK)) - return FALSE; - - GST_DEBUG_CATEGORY_INIT (gst_debug_x_image_sink, "ximagesink", 0, - "ximagesink element"); - GST_DEBUG_CATEGORY_INIT (gst_debug_x_image_pool, "ximagepool", 0, - "ximagepool object"); - - GST_DEBUG_CATEGORY_GET (CAT_PERFORMANCE, "GST_PERFORMANCE"); - - return TRUE; + return GST_ELEMENT_REGISTER (ximagesink, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/sys/ximage/ximagepool.c b/sys/ximage/ximagepool.c index 3f95e84511..4d3871d1b6 100644 --- a/sys/ximage/ximagepool.c +++ b/sys/ximage/ximagepool.c @@ -32,7 +32,7 @@ #include #include -GST_DEBUG_CATEGORY_EXTERN (gst_debug_x_image_pool); +GST_DEBUG_CATEGORY (gst_debug_x_image_pool); #define GST_CAT_DEFAULT gst_debug_x_image_pool /* X11 stuff */ diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index f1bab94176..07b7f179db 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -115,8 +115,10 @@ /* for XkbKeycodeToKeysym */ #include -GST_DEBUG_CATEGORY_EXTERN (gst_debug_x_image_sink); -GST_DEBUG_CATEGORY_EXTERN (CAT_PERFORMANCE); +GST_DEBUG_CATEGORY_EXTERN (gst_debug_x_image_pool); +GST_DEBUG_CATEGORY (gst_debug_x_image_sink); +GST_DEBUG_CATEGORY_STATIC (CAT_PERFORMANCE); + #define GST_CAT_DEFAULT gst_debug_x_image_sink typedef struct @@ -179,6 +181,13 @@ G_DEFINE_TYPE_WITH_CODE (GstXImageSink, gst_x_image_sink, GST_TYPE_VIDEO_SINK, G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_OVERLAY, gst_x_image_sink_video_overlay_init)); +#define _do_init \ + GST_DEBUG_CATEGORY_INIT (gst_debug_x_image_sink, "ximagesink", 0, "ximagesink element");\ + GST_DEBUG_CATEGORY_INIT (gst_debug_x_image_pool, "ximagepool", 0, "ximagepool object");\ + GST_DEBUG_CATEGORY_GET (CAT_PERFORMANCE, "GST_PERFORMANCE"); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (ximagesink, "ximagesink", + GST_RANK_SECONDARY, GST_TYPE_X_IMAGE_SINK, _do_init); + /* ============================================================= */ /* */ /* Private Methods */ diff --git a/sys/ximage/ximagesink.h b/sys/ximage/ximagesink.h index 8574ef3c13..98dce61901 100644 --- a/sys/ximage/ximagesink.h +++ b/sys/ximage/ximagesink.h @@ -208,6 +208,7 @@ struct _GstXImageSinkClass }; GType gst_x_image_sink_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (ximagesink); G_END_DECLS #endif /* __GST_X_IMAGE_SINK_H__ */