From 9d570688deef16a69d71e997bc020aac96353c26 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 18 Aug 2003 21:14:16 +0000 Subject: [PATCH] Remove duplicate rank field (fixes #119510) Original commit message from CVS: Remove duplicate rank field (fixes #119510) --- gst/autoplug/gstsearchfuncs.c | 6 +++--- gst/gstelement.h | 4 ---- gst/gstelementfactory.c | 16 ---------------- gst/registries/gstxmlregistry.c | 17 +++++------------ 4 files changed, 8 insertions(+), 35 deletions(-) diff --git a/gst/autoplug/gstsearchfuncs.c b/gst/autoplug/gstsearchfuncs.c index 4378d2826c..2602c212f4 100644 --- a/gst/autoplug/gstsearchfuncs.c +++ b/gst/autoplug/gstsearchfuncs.c @@ -236,8 +236,8 @@ gst_autoplug_factories_filters (GList *factories) static gint gst_autoplug_rank_compare (const GstElementFactory *a, const GstElementFactory *b) { - if (a->rank > b->rank) return -1; - return (a->rank < b->rank) ? 1 : 0; + if (GST_PLUGIN_FEATURE (a)->rank > GST_PLUGIN_FEATURE (b)->rank) return -1; + return (GST_PLUGIN_FEATURE (a)->rank < GST_PLUGIN_FEATURE (b)->rank) ? 1 : 0; } /* returns all factories which have sinks with non-NULL caps and srcs with @@ -255,7 +255,7 @@ gst_autoplug_factories_filters_with_sink_caps (GList *factories) { factory = (GstElementFactory *) factories->data; templs = factory->padtemplates; - if (factory->rank > 0){ + if (GST_PLUGIN_FEATURE (factory)->rank > 0){ gboolean have_src = FALSE; gboolean have_sink = FALSE; diff --git a/gst/gstelement.h b/gst/gstelement.h index f86dada986..4eb1b623f5 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -386,8 +386,6 @@ struct _GstElementFactory { GList *padtemplates; guint16 numpadtemplates; - - guint16 rank; /* used by autoplug to prioritise elements to try */ }; struct _GstElementFactoryClass { @@ -413,8 +411,6 @@ GstElement* gst_element_factory_create (GstElementFactory *factory, GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name); GstElement* gst_element_factory_make_or_warn (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 f91c91c42e..c222888d24 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -406,22 +406,6 @@ 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) { diff --git a/gst/registries/gstxmlregistry.c b/gst/registries/gstxmlregistry.c index 516e662917..c23a57a129 100644 --- a/gst/registries/gstxmlregistry.c +++ b/gst/registries/gstxmlregistry.c @@ -691,11 +691,6 @@ gst_xml_registry_parse_element_factory (GMarkupParseContext *context, const gcha else if (!strcmp(tag, "copyright")) { factory->details->copyright = g_strndup (text, text_len); } - else if (!strcmp(tag, "rank")) { - gint value; - sscanf (text, "%d", &value); - factory->rank = value; - } return TRUE; } @@ -914,7 +909,6 @@ gst_xml_registry_start_element (GMarkupParseContext *context, factory->details_dynamic = TRUE; factory->details = g_new0(GstElementDetails, 1); factory->padtemplates = NULL; - factory->rank = 0; xmlregistry->parser = gst_xml_registry_parse_element_factory; break; } @@ -1444,6 +1438,11 @@ gst_xml_registry_save_feature (GstXMLRegistry *xmlregistry, GstPluginFeature *fe { PUT_ESCAPED ("name", feature->name); + if (feature->rank > 0) { + gint rank = feature->rank; + CLASS (xmlregistry)->save_func (xmlregistry, "%d\n", rank); + } + if (GST_IS_ELEMENT_FACTORY (feature)) { GstElementFactory *factory = GST_ELEMENT_FACTORY (feature); GList *templates; @@ -1456,12 +1455,6 @@ gst_xml_registry_save_feature (GstXMLRegistry *xmlregistry, GstPluginFeature *fe PUT_ESCAPED ("author", factory->details->author); PUT_ESCAPED ("copyright", factory->details->copyright); - /* only write the rank if it is greater than zero */ - if (factory->rank > 0) { - gint rank = factory->rank; - CLASS (xmlregistry)->save_func (xmlregistry, "%d\n", rank); - } - templates = factory->padtemplates; while (templates) {