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
{
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;
GList *padtemplates;
guint16 numpadtemplates;
-
- guint16 rank; /* used by autoplug to prioritise elements to try */
};
struct _GstElementFactoryClass {
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
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)
{
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;
}
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;
}
{
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)) {
GstElementFactory *factory = GST_ELEMENT_FACTORY (feature);
GList *templates;
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, "<rank>%d</rank>\n", rank);
- }
-
templates = factory->padtemplates;
while (templates) {