Index: gstdecodebin.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c,v
retrieving revision 1.72
diff -u -3 -p -b -B -d -r1.72 gstdecodebin.c
--- gstdecodebin.c	11 May 2006 19:38:22 -0000	1.72
+++ gstdecodebin.c	12 May 2006 06:39:07 -0000
@@ -560,11 +560,10 @@ close_pad_link (GstElement * element, Gs
   gchar *padname;
   gint diff;
 
+  /* hack.. ignore current pads */
   padname = gst_pad_get_name (pad);
   diff = strncmp (padname, "current_", 8);
   g_free (padname);
-
-  /* hack.. ignore current pads */
   if (!diff)
     return;
 
@@ -573,10 +572,17 @@ close_pad_link (GstElement * element, Gs
   if (caps == NULL || gst_caps_is_empty (caps))
     goto unknown_type;
 
-  /* the caps is any, this means the pad can be anything and
-   * we don't know yet */
-  if (gst_caps_is_any (caps))
-    goto dont_know_yet;
+  /* If the caps is any, we leave it to a new decodebin to figure out
+   * how to handle the stream. */
+  if (gst_caps_is_any (caps)) {
+    GList *to_try = NULL;
+
+    GST_DEBUG_OBJECT (decode_bin, "adding another decodebin");
+    to_try = g_list_append (to_try, gst_element_factory_find ("decodebin"));
+    try_to_link_1 (decode_bin, element, pad, to_try);
+    g_list_free (to_try);
+    return;
+  }
 
   GST_LOG_OBJECT (element, "trying to close %" GST_PTR_FORMAT, caps);
 
@@ -646,11 +652,6 @@ unknown_type:
         gst_decode_bin_signals[SIGNAL_UNKNOWN_TYPE], 0, pad, caps);
     return;
   }
-dont_know_yet:
-  {
-    GST_LOG_OBJECT (pad, "type is not known yet, waiting to close link");
-    return;
-  }
 many_types:
   {
     GST_LOG_OBJECT (pad, "many possible types, waiting to close link");
