From: Stéphane Cerveau Date: Mon, 29 Mar 2021 11:23:51 +0000 (+0200) Subject: dvdsub: allow per feature registration X-Git-Tag: 1.19.3~505^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f2a9ea9d7b511b79af0786bcded59d5bbdd5de5e;p=platform%2Fupstream%2Fgstreamer.git dvdsub: 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: --- diff --git a/gst/dvdsub/gstdvdsubdec.c b/gst/dvdsub/gstdvdsubdec.c index 8601ec8..1884880 100644 --- a/gst/dvdsub/gstdvdsubdec.c +++ b/gst/dvdsub/gstdvdsubdec.c @@ -26,8 +26,14 @@ #include "gstdvdsubparse.h" #include +GST_DEBUG_CATEGORY_STATIC (gst_dvd_sub_dec_debug); +#define GST_CAT_DEFAULT (gst_dvd_sub_dec_debug) + #define gst_dvd_sub_dec_parent_class parent_class G_DEFINE_TYPE (GstDvdSubDec, gst_dvd_sub_dec, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (dvdsubdec, "dvdsubdec", GST_RANK_NONE, + GST_TYPE_DVD_SUB_DEC, GST_DEBUG_CATEGORY_INIT (gst_dvd_sub_dec_debug, + "dvdsubdec", 0, "DVD subtitle decoder")); static gboolean gst_dvd_sub_dec_src_event (GstPad * srcpad, GstObject * parent, GstEvent * event); @@ -61,8 +67,6 @@ static GstStaticPadTemplate subtitle_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_CAPS ("subpicture/x-dvd") ); -GST_DEBUG_CATEGORY_STATIC (gst_dvd_sub_dec_debug); -#define GST_CAT_DEFAULT (gst_dvd_sub_dec_debug) enum { @@ -1145,17 +1149,12 @@ not_handled: static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "dvdsubdec", GST_RANK_NONE, - GST_TYPE_DVD_SUB_DEC) || - !gst_element_register (plugin, "dvdsubparse", GST_RANK_NONE, - GST_TYPE_DVD_SUB_PARSE)) { - return FALSE; - } + gboolean ret = FALSE; - GST_DEBUG_CATEGORY_INIT (gst_dvd_sub_dec_debug, "dvdsubdec", 0, - "DVD subtitle decoder"); + ret |= GST_ELEMENT_REGISTER (dvdsubdec, plugin); + ret |= GST_ELEMENT_REGISTER (dvdsubparse, plugin); - return TRUE; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/dvdsub/gstdvdsubdec.h b/gst/dvdsub/gstdvdsubdec.h index a75e439..0c69677 100644 --- a/gst/dvdsub/gstdvdsubdec.h +++ b/gst/dvdsub/gstdvdsubdec.h @@ -17,10 +17,14 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ +#ifndef __GST_DVDSUBDEC_H__ +#define __GST_DVDSUBDEC_H__ #include #include +G_BEGIN_DECLS + #define GST_TYPE_DVD_SUB_DEC (gst_dvd_sub_dec_get_type()) #define GST_DVD_SUB_DEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DVD_SUB_DEC,GstDvdSubDec)) #define GST_DVD_SUB_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DVD_SUB_DEC,GstDvdSubDecClass)) @@ -100,3 +104,8 @@ struct _GstDvdSubDecClass }; GType gst_dvd_sub_dec_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (dvdsubdec); + +G_END_DECLS + +#endif /* __GST_DVDSUBDEC_H__ */ diff --git a/gst/dvdsub/gstdvdsubparse.c b/gst/dvdsub/gstdvdsubparse.c index 4184a41..9d0e1d0 100644 --- a/gst/dvdsub/gstdvdsubparse.c +++ b/gst/dvdsub/gstdvdsubparse.c @@ -54,6 +54,8 @@ static GstStateChangeReturn gst_dvd_sub_parse_change_state (GstElement * #define gst_dvd_sub_parse_parent_class parent_class G_DEFINE_TYPE (GstDvdSubParse, gst_dvd_sub_parse, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE (dvdsubparse, "dvdsubparse", GST_RANK_NONE, + GST_TYPE_DVD_SUB_PARSE); static void gst_dvd_sub_parse_class_init (GstDvdSubParseClass * klass) diff --git a/gst/dvdsub/gstdvdsubparse.h b/gst/dvdsub/gstdvdsubparse.h index 6149232..0df1ad0 100644 --- a/gst/dvdsub/gstdvdsubparse.h +++ b/gst/dvdsub/gstdvdsubparse.h @@ -58,6 +58,7 @@ struct _GstDvdSubParseClass { }; GType gst_dvd_sub_parse_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (dvdsubparse); G_END_DECLS