add a rank to elementfactory for autoplugging
authorSteve Baker <steve@stevebaker.org>
Fri, 31 May 2002 08:17:15 +0000 (08:17 +0000)
committerSteve Baker <steve@stevebaker.org>
Fri, 31 May 2002 08:17:15 +0000 (08:17 +0000)
Original commit message from CVS:
add a rank to elementfactory for autoplugging

gst/gstelement.h
gst/gstelementfactory.c

index 59b986a..c86bf09 100644 (file)
@@ -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
 
 
index 8505d04..a706cbf 100644 (file)
@@ -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)
 {