From 1b0d570ee309b7d0a5a532a6bf73f6062e486a1d Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Cerveau?= Date: Fri, 19 Feb 2021 11:40:40 +0100 Subject: [PATCH] resindvd: 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/resindvd/plugin.c | 22 +--------------------- ext/resindvd/resindvdbin.c | 30 ++++++++++++++++++++++++++++++ ext/resindvd/resindvdbin.h | 2 ++ 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/ext/resindvd/plugin.c b/ext/resindvd/plugin.c index 15bca9d..da9dcfc 100644 --- a/ext/resindvd/plugin.c +++ b/ext/resindvd/plugin.c @@ -25,32 +25,12 @@ #include "resindvdbin.h" #include "gstmpegdemux.h" -#include -GST_DEBUG_CATEGORY (resindvd_debug); -#define GST_CAT_DEFAULT resindvd_debug static gboolean plugin_init (GstPlugin * plugin) { - gboolean result = TRUE; - - GST_DEBUG_CATEGORY_INIT (resindvd_debug, "resindvd", - 0, "DVD playback elements from resindvd"); - -#ifdef ENABLE_NLS - GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, - LOCALEDIR); - bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); -#endif - - result &= gst_element_register (plugin, "rsndvdbin", - GST_RANK_PRIMARY, RESIN_TYPE_DVDBIN); - - result &= gst_flups_demux_plugin_init (plugin); - - return result; + return GST_ELEMENT_REGISTER (rsndvdbin, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/ext/resindvd/resindvdbin.c b/ext/resindvd/resindvdbin.c index ce2bd1c..76727f2 100644 --- a/ext/resindvd/resindvdbin.c +++ b/ext/resindvd/resindvdbin.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "resindvdbin.h" #include "resindvdsrc.h" @@ -84,10 +85,12 @@ GST_STATIC_PAD_TEMPLATE ("subpicture", static void rsn_dvdbin_finalize (GObject * object); static void rsn_dvdbin_uri_handler_init (gpointer g_iface, gpointer iface_data); +static gboolean rsndvdbin_element_init (GstPlugin * plugin); #define rsn_dvdbin_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (RsnDvdBin, rsn_dvdbin, GST_TYPE_BIN, G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, rsn_dvdbin_uri_handler_init)); +GST_ELEMENT_REGISTER_DEFINE_CUSTOM (rsndvdbin, rsndvdbin_element_init); static void demux_pad_added (GstElement * element, GstPad * pad, RsnDvdBin * dvdbin); @@ -100,6 +103,10 @@ static GstStateChangeReturn rsn_dvdbin_change_state (GstElement * element, GstStateChange transition); static void rsn_dvdbin_no_more_pads (RsnDvdBin * dvdbin); + +GST_DEBUG_CATEGORY (resindvd_debug); +#define GST_CAT_DEFAULT resindvd_debug + static void rsn_dvdbin_class_init (RsnDvdBinClass * klass) { @@ -1029,3 +1036,26 @@ rsn_dvdbin_change_state (GstElement * element, GstStateChange transition) return ret; } + +static gboolean +rsndvdbin_element_init (GstPlugin * plugin) +{ + gboolean result = TRUE; + + GST_DEBUG_CATEGORY_INIT (resindvd_debug, "resindvd", + 0, "DVD playback elements from resindvd"); + +#ifdef ENABLE_NLS + GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, + LOCALEDIR); + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif + + result &= gst_element_register (plugin, "rsndvdbin", + GST_RANK_PRIMARY, RESIN_TYPE_DVDBIN); + + result &= gst_flups_demux_plugin_init (plugin); + + return result; +} diff --git a/ext/resindvd/resindvdbin.h b/ext/resindvd/resindvdbin.h index 2eab516..d92e1b4 100644 --- a/ext/resindvd/resindvdbin.h +++ b/ext/resindvd/resindvdbin.h @@ -86,6 +86,8 @@ struct _RsnDvdBinClass GType rsn_dvdbin_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (rsndvdbin); + G_END_DECLS #endif /* __RESINDVDBIN_H__ */ -- 2.7.4