From 141b8c4399e9f0431466ba525796d6a8f196da76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Mon, 29 Mar 2021 14:10:12 +0200 Subject: [PATCH] xvimage: 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/xvimage/xvcontext.c | 2 +- sys/xvimage/xvimage.c | 16 +--------------- sys/xvimage/xvimagepool.c | 2 +- sys/xvimage/xvimagesink.c | 11 ++++++++++- sys/xvimage/xvimagesink.h | 1 + 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/sys/xvimage/xvcontext.c b/sys/xvimage/xvcontext.c index b240cc8392..56dee97e04 100644 --- a/sys/xvimage/xvcontext.c +++ b/sys/xvimage/xvcontext.c @@ -33,7 +33,7 @@ /* for XkbKeycodeToKeysym */ #include -GST_DEBUG_CATEGORY_EXTERN (gst_debug_xv_context); +GST_DEBUG_CATEGORY (gst_debug_xv_context); #define GST_CAT_DEFAULT gst_debug_xv_context void diff --git a/sys/xvimage/xvimage.c b/sys/xvimage/xvimage.c index e0295bc698..837306e65e 100644 --- a/sys/xvimage/xvimage.c +++ b/sys/xvimage/xvimage.c @@ -23,25 +23,11 @@ #include "xvimagesink.h" -GST_DEBUG_CATEGORY (gst_debug_xv_context); -GST_DEBUG_CATEGORY (gst_debug_xv_image_pool); -GST_DEBUG_CATEGORY (gst_debug_xv_image_sink); static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "xvimagesink", - GST_RANK_PRIMARY, GST_TYPE_XV_IMAGE_SINK)) - return FALSE; - - GST_DEBUG_CATEGORY_INIT (gst_debug_xv_context, "xcontext", 0, - "xcontext miniobject"); - GST_DEBUG_CATEGORY_INIT (gst_debug_xv_image_sink, "xvimagesink", 0, - "xvimagesink element"); - GST_DEBUG_CATEGORY_INIT (gst_debug_xv_image_pool, "xvimagepool", 0, - "xvimagepool object"); - - return TRUE; + return GST_ELEMENT_REGISTER (xvimagesink, plugin);; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/sys/xvimage/xvimagepool.c b/sys/xvimage/xvimagepool.c index fb87c7bfac..6e9a57d630 100644 --- a/sys/xvimage/xvimagepool.c +++ b/sys/xvimage/xvimagepool.c @@ -34,7 +34,7 @@ #include -GST_DEBUG_CATEGORY_EXTERN (gst_debug_xv_image_pool); +GST_DEBUG_CATEGORY (gst_debug_xv_image_pool); #define GST_CAT_DEFAULT gst_debug_xv_image_pool /* bufferpool */ diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index aded234fe2..352648982b 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -132,7 +132,10 @@ /* for XkbKeycodeToKeysym */ #include -GST_DEBUG_CATEGORY_EXTERN (gst_debug_xv_image_sink); +GST_DEBUG_CATEGORY_EXTERN (gst_debug_xv_context); +GST_DEBUG_CATEGORY_EXTERN (gst_debug_xv_image_pool); +GST_DEBUG_CATEGORY (gst_debug_xv_image_sink); + #define GST_CAT_DEFAULT gst_debug_xv_image_sink GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE); @@ -213,7 +216,13 @@ G_DEFINE_TYPE_WITH_CODE (GstXvImageSink, gst_xv_image_sink, GST_TYPE_VIDEO_SINK, gst_xv_image_sink_video_overlay_init); G_IMPLEMENT_INTERFACE (GST_TYPE_COLOR_BALANCE, gst_xv_image_sink_colorbalance_init)); +#define _do_init \ + GST_DEBUG_CATEGORY_INIT (gst_debug_xv_context, "xcontext", 0, "xcontext miniobject");\ + GST_DEBUG_CATEGORY_INIT (gst_debug_xv_image_sink, "xvimagesink", 0, "ximagesink element");\ + GST_DEBUG_CATEGORY_INIT (gst_debug_xv_image_pool, "xvimagepool", 0, "ximagepool object");\ +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (xvimagesink, "xvimagesink", + GST_RANK_PRIMARY, GST_TYPE_XV_IMAGE_SINK, _do_init); /* ============================================================= */ /* */ diff --git a/sys/xvimage/xvimagesink.h b/sys/xvimage/xvimagesink.h index 9bf4d79c88..6f5ffa156c 100644 --- a/sys/xvimage/xvimagesink.h +++ b/sys/xvimage/xvimagesink.h @@ -132,6 +132,7 @@ struct _GstXvImageSinkClass }; GType gst_xv_image_sink_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (xvimagesink); G_END_DECLS #endif /* __GST_XV_IMAGE_SINK_H__ */