Remove duplicate rank field (fixes #119510)

Original commit message from CVS:
Remove duplicate rank field (fixes #119510)
This commit is contained in:
Ronald S. Bultje 2003-08-18 21:14:16 +00:00
parent c8bdc194d0
commit 9d570688de
4 changed files with 8 additions and 35 deletions

View file

@ -236,8 +236,8 @@ gst_autoplug_factories_filters (GList *factories)
static gint static gint
gst_autoplug_rank_compare (const GstElementFactory *a, const GstElementFactory *b) gst_autoplug_rank_compare (const GstElementFactory *a, const GstElementFactory *b)
{ {
if (a->rank > b->rank) return -1; if (GST_PLUGIN_FEATURE (a)->rank > GST_PLUGIN_FEATURE (b)->rank) return -1;
return (a->rank < b->rank) ? 1 : 0; 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 /* 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; factory = (GstElementFactory *) factories->data;
templs = factory->padtemplates; templs = factory->padtemplates;
if (factory->rank > 0){ if (GST_PLUGIN_FEATURE (factory)->rank > 0){
gboolean have_src = FALSE; gboolean have_src = FALSE;
gboolean have_sink = FALSE; gboolean have_sink = FALSE;

View file

@ -386,8 +386,6 @@ struct _GstElementFactory {
GList *padtemplates; GList *padtemplates;
guint16 numpadtemplates; guint16 numpadtemplates;
guint16 rank; /* used by autoplug to prioritise elements to try */
}; };
struct _GstElementFactoryClass { 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 (const gchar *factoryname, const gchar *name);
GstElement* gst_element_factory_make_or_warn (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 G_END_DECLS

View file

@ -406,22 +406,6 @@ gst_element_factory_can_sink_caps (GstElementFactory *factory,
return FALSE; 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 static void
gst_element_factory_unload_thyself (GstPluginFeature *feature) gst_element_factory_unload_thyself (GstPluginFeature *feature)
{ {

View file

@ -691,11 +691,6 @@ gst_xml_registry_parse_element_factory (GMarkupParseContext *context, const gcha
else if (!strcmp(tag, "copyright")) { else if (!strcmp(tag, "copyright")) {
factory->details->copyright = g_strndup (text, text_len); factory->details->copyright = g_strndup (text, text_len);
} }
else if (!strcmp(tag, "rank")) {
gint value;
sscanf (text, "%d", &value);
factory->rank = value;
}
return TRUE; return TRUE;
} }
@ -914,7 +909,6 @@ gst_xml_registry_start_element (GMarkupParseContext *context,
factory->details_dynamic = TRUE; factory->details_dynamic = TRUE;
factory->details = g_new0(GstElementDetails, 1); factory->details = g_new0(GstElementDetails, 1);
factory->padtemplates = NULL; factory->padtemplates = NULL;
factory->rank = 0;
xmlregistry->parser = gst_xml_registry_parse_element_factory; xmlregistry->parser = gst_xml_registry_parse_element_factory;
break; break;
} }
@ -1444,6 +1438,11 @@ gst_xml_registry_save_feature (GstXMLRegistry *xmlregistry, GstPluginFeature *fe
{ {
PUT_ESCAPED ("name", feature->name); PUT_ESCAPED ("name", feature->name);
if (feature->rank > 0) {
gint rank = feature->rank;
CLASS (xmlregistry)->save_func (xmlregistry, "<rank>%d</rank>\n", rank);
}
if (GST_IS_ELEMENT_FACTORY (feature)) { if (GST_IS_ELEMENT_FACTORY (feature)) {
GstElementFactory *factory = GST_ELEMENT_FACTORY (feature); GstElementFactory *factory = GST_ELEMENT_FACTORY (feature);
GList *templates; GList *templates;
@ -1456,12 +1455,6 @@ gst_xml_registry_save_feature (GstXMLRegistry *xmlregistry, GstPluginFeature *fe
PUT_ESCAPED ("author", factory->details->author); PUT_ESCAPED ("author", factory->details->author);
PUT_ESCAPED ("copyright", factory->details->copyright); 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, "<rank>%d</rank>\n", rank);
}
templates = factory->padtemplates; templates = factory->padtemplates;
while (templates) { while (templates) {