From 5d902beab8441a313268871e7d9cbd9e0579d7b4 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Fri, 31 May 2002 08:17:15 +0000 Subject: [PATCH] add a rank to elementfactory for autoplugging Original commit message from CVS: add a rank to elementfactory for autoplugging --- gst/gstelement.h | 9 +++++++++ gst/gstelementfactory.c | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/gst/gstelement.h b/gst/gstelement.h index 59b986a732..c86bf09492 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -304,6 +304,11 @@ struct _GstElementDetails { #define GST_IS_ELEMENT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ELEMENT_FACTORY)) #define GST_IS_ELEMENT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ELEMENT_FACTORY)) +#define GST_ELEMENT_RANK_PRIMARY 256 +#define GST_ELEMENT_RANK_SECONDARY 128 +#define GST_ELEMENT_RANK_MARGINAL 64 +#define GST_ELEMENT_RANK_NONE 0 + struct _GstElementFactory { GstPluginFeature feature; @@ -315,6 +320,8 @@ struct _GstElementFactory { GList *padtemplates; guint16 numpadtemplates; + + guint16 rank; /* used by autoplug to prioritise elements to try */ }; struct _GstElementFactoryClass { @@ -340,6 +347,8 @@ GstElement* gst_element_factory_create (GstElementFactory *factory, /* FIXME this name is wrong, probably so is the one above it */ GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name); +void gst_element_factory_set_rank (GstElementFactory *factory, guint16 rank); + G_END_DECLS diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index 8505d048fa..a706cbf371 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -360,6 +360,22 @@ gst_element_factory_can_sink_caps (GstElementFactory *factory, return FALSE; } +/** + * gst_element_factory_set_rank : + * @factory: factory to rank + * @rank: rank value - higher number means more priority rank + * + * Specifies a rank for the element so that + * autoplugging uses the most appropriate elements. + * + */ +void +gst_element_factory_set_rank (GstElementFactory *factory, guint16 rank) +{ + g_return_if_fail(factory != NULL); + factory->rank = rank; +} + static void gst_element_factory_unload_thyself (GstPluginFeature *feature) {