Index: gstdecodebin2.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstdecodebin2.c,v
retrieving revision 1.13
diff -u -p -r1.13 gstdecodebin2.c
--- gstdecodebin2.c	2 Mar 2007 12:59:15 -0000	1.13
+++ gstdecodebin2.c	3 Mar 2007 11:55:52 -0000
@@ -101,15 +101,19 @@ struct _GstDecodeBinClass
 
   /* signal we fire when a new pad has been decoded into raw audio/video */
   void (*new_decoded_pad) (GstElement * element, GstPad * pad, gboolean last);
+
   /* signal we fire when a pad has been removed */
   void (*removed_decoded_pad) (GstElement * element, GstPad * pad);
+
   /* signal fired when we found a pad that we cannot decode */
   void (*unknown_type) (GstElement * element, GstPad * pad, GstCaps * caps);
+
   /* signal fired to know if we continue trying to decode the given caps */
-    gboolean (*autoplug_continue) (GstElement * element, GstCaps * caps);
+  gboolean (*autoplug_continue) (GstElement * element, GstCaps * caps);
+
   /* signal fired to reorder the proposed list of factories */
-    gboolean (*autoplug_sort) (GstElement * element, GstCaps * caps,
-      GList ** list);
+  gboolean (*autoplug_sort) (GstElement * element, GstCaps * caps,
+      GValueArray * list);
 };
 
 /* signals */
@@ -149,7 +153,7 @@ static void type_found (GstElement * typ
 static gboolean gst_decode_bin_autoplug_continue (GstElement * element,
     GstCaps * caps);
 static gboolean gst_decode_bin_autoplug_sort (GstElement * element,
-    GstCaps * caps, GList ** list);
+    GstCaps * caps, GValueArray * list);
 static void gst_decode_bin_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
 static void gst_decode_bin_get_property (GObject * object, guint prop_id,
@@ -408,8 +412,8 @@ gst_decode_bin_class_init (GstDecodeBinC
   gst_decode_bin_signals[SIGNAL_AUTOPLUG_SORT] =
       g_signal_new ("autoplug-sort", G_TYPE_FROM_CLASS (klass),
       G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDecodeBinClass, autoplug_sort),
-      _gst_boolean_accumulator, NULL, gst_play_marshal_BOOLEAN__OBJECT_POINTER,
-      G_TYPE_BOOLEAN, 2, GST_TYPE_CAPS, G_TYPE_POINTER);
+      _gst_boolean_accumulator, NULL, gst_play_marshal_BOOLEAN__OBJECT_BOXED,
+      G_TYPE_BOOLEAN, 2, GST_TYPE_CAPS, G_TYPE_VALUE_ARRAY);
 
   g_object_class_install_property (gobject_klass, PROP_CAPS,
       g_param_spec_boxed ("caps", "Caps", "The caps on which to stop decoding.",
@@ -697,7 +701,7 @@ gst_decode_bin_autoplug_continue (GstEle
 
 static gboolean
 gst_decode_bin_autoplug_sort (GstElement * element, GstCaps * caps,
-    GList ** list)
+    GValueArray * list)
 {
   return TRUE;
 }
@@ -710,11 +714,11 @@ gst_decode_bin_autoplug_sort (GstElement
 
 static gboolean are_raw_caps (GstDecodeBin * dbin, GstCaps * caps);
 static gboolean is_demuxer_element (GstElement * srcelement);
-static GList *find_compatibles (GstDecodeBin * decode_bin,
+static GValueArray *find_compatibles (GstDecodeBin * decode_bin,
     const GstCaps * caps);
 
 static gboolean connect_pad (GstDecodeBin * dbin, GstElement * src,
-    GstPad * pad, GList * factories, GstDecodeGroup * group);
+    GstPad * pad, GValueArray * factories, GstDecodeGroup * group);
 static gboolean connect_element (GstDecodeBin * dbin, GstElement * element,
     GstDecodeGroup * group);
 static void expose_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
@@ -739,7 +743,7 @@ analyze_new_pad (GstDecodeBin * dbin, Gs
     GstCaps * caps, GstDecodeGroup * group)
 {
   gboolean apcontinue = TRUE;
-  GList *factories = NULL;
+  GValueArray *factories;
   gboolean apsort = TRUE;
 
   GST_DEBUG_OBJECT (dbin, "Pad %s:%s caps:%" GST_PTR_FORMAT,
@@ -759,27 +763,31 @@ analyze_new_pad (GstDecodeBin * dbin, Gs
   if ((!apcontinue) || are_raw_caps (dbin, caps))
     goto expose_pad;
 
-  /* 1.b else if there's no compatible factory or 'autoplug-sort' returned FALSE, goto pad_not_used */
-  if ((factories = find_compatibles (dbin, caps))) {
-    /* emit autoplug-sort */
-    g_signal_emit (G_OBJECT (dbin),
-        gst_decode_bin_signals[SIGNAL_AUTOPLUG_SORT],
-        0, caps, &factories, &apsort);
-    if (!apsort) {
-      g_list_free (factories);
-      /* User doesn't want that pad */
-      goto pad_not_wanted;
-    }
-  } else {
+  /* 1.b else if there's no compatible factory or 'autoplug-sort'
+   * returned FALSE, goto pad_not_used */
+  factories = find_compatibles (dbin, caps);
+  if (factories->n_values == 0) {
     /* no compatible factories */
+    g_value_array_free (factories);
     goto unknown_type;
   }
 
+  /* emit autoplug-sort */
+  g_signal_emit (G_OBJECT (dbin),
+      gst_decode_bin_signals[SIGNAL_AUTOPLUG_SORT],
+      0, caps, factories, &apsort);
+
+  if (!apsort) {
+    /* User doesn't want that pad */
+    g_value_array_free (factories);
+    goto pad_not_wanted;
+  }
+
   /* 1.c else goto pad_is_valid */
   GST_LOG_OBJECT (pad, "Let's continue discovery on this pad");
 
   connect_pad (dbin, src, pad, factories, group);
-  g_list_free (factories);
+  g_value_array_free (factories);
 
   return;
 
@@ -831,12 +839,13 @@ any_caps:
 
 static gboolean
 connect_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
-    GList * factories, GstDecodeGroup * group)
+    GValueArray * factories, GstDecodeGroup * group)
 {
   gboolean res = FALSE;
-  GList *tmp;
+  guint i;
+
+  g_assert (factories != NULL);
 
-  g_return_val_if_fail (factories != NULL, FALSE);
   GST_DEBUG_OBJECT (dbin, "pad %s:%s , group:%p",
       GST_DEBUG_PAD_NAME (pad), group);
 
@@ -860,10 +869,14 @@ connect_pad (GstDecodeBin * dbin, GstEle
   }
 
   /* 2. Try to create an element and link to it */
-  for (tmp = factories; tmp; tmp = g_list_next (tmp)) {
-    GstElementFactory *factory = (GstElementFactory *) tmp->data;
+  for (i = 0; i < factories->n_values; ++i) {
+    GstElementFactory *factory;
     GstElement *element;
     GstPad *sinkpad;
+    GValue *val;
+
+    val = g_value_array_get_nth (factories, i);
+    factory = GST_ELEMENT_FACTORY (g_value_get_object (val));
 
     /* 2.1. Try to create an element */
     if ((element = gst_element_factory_create (factory, NULL)) == NULL) {
@@ -1202,14 +1215,16 @@ no_group:
   }
 }
 
-/* this function runs through the element factories and returns a list
+/* this function runs through the element factories and returns a value array
  * of all elements that are able to sink the given caps 
  */
-static GList *
+static GValueArray *
 find_compatibles (GstDecodeBin * decode_bin, const GstCaps * caps)
 {
+  GValueArray *to_try;
   GList *factories;
-  GList *to_try = NULL;
+
+  to_try = g_value_array_new (1);
 
   /* loop over all the factories */
   for (factories = decode_bin->factories; factories;
@@ -1236,8 +1251,13 @@ find_compatibles (GstDecodeBin * decode_
 
         /* check if the intersection is empty */
         if (!gst_caps_is_empty (intersect)) {
+          GValue val = { 0, };
+
           /* non empty intersection, we can use this element */
-          to_try = g_list_prepend (to_try, factory);
+          g_value_init (&val, GST_TYPE_ELEMENT_FACTORY);
+          g_value_set_object (&val, factory);
+          g_value_array_append (to_try, &val);
+          g_value_unset (&val);
           gst_caps_unref (intersect);
           break;
         }
@@ -1245,7 +1265,6 @@ find_compatibles (GstDecodeBin * decode_
       }
     }
   }
-  to_try = g_list_reverse (to_try);
 
   return to_try;
 }
Index: gstplay-marshal.list
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplay-marshal.list,v
retrieving revision 1.3
diff -u -p -r1.3 gstplay-marshal.list
--- gstplay-marshal.list	28 Nov 2006 14:40:39 -0000	1.3
+++ gstplay-marshal.list	3 Mar 2007 11:55:52 -0000
@@ -1,3 +1,3 @@
 BOOLEAN:OBJECT
 VOID:OBJECT,BOOLEAN
-BOOLEAN:OBJECT,POINTER
+BOOLEAN:OBJECT,BOXED
