Index: gstplaybasebin.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v
retrieving revision 1.115
diff -u -3 -p -b -B -d -r1.115 gstplaybasebin.c
--- gstplaybasebin.c	26 Jul 2006 10:31:06 -0000	1.115
+++ gstplaybasebin.c	8 Aug 2006 20:23:07 -0000
@@ -855,7 +855,7 @@ unknown_type (GstElement * element, GstP
   GstPlayBaseGroup *group;
 
   capsstr = gst_caps_to_string (caps);
-  g_message ("don't know how to handle %s", capsstr);
+  GST_DEBUG_OBJECT (play_base_bin, "don't know how to handle %s", capsstr);
 
   GROUP_LOCK (play_base_bin);
 
@@ -906,7 +906,7 @@ static void
 no_more_pads (GstElement * element, GstPlayBaseBin * play_base_bin)
 {
   /* setup phase */
-  GST_DEBUG ("no more pads");
+  GST_DEBUG_OBJECT (element, "no more pads");
 
   /* we can commit this group for playback now */
   group_commit (play_base_bin, play_base_bin->is_stream,
@@ -1262,12 +1262,6 @@ gen_source_element (GstPlayBaseBin * pla
   if (!play_base_bin->uri)
     return NULL;
 
-  if (g_str_has_prefix (play_base_bin->uri, "rtsp://")) {
-    GST_ELEMENT_ERROR (play_base_bin, RESOURCE, FAILED,
-        (_("RTSP streams cannot be played yet.")), (NULL));
-    return NULL;
-  }
-
   if (play_base_bin->suburi) {
     /* subtitle specified */
     *subbin = setup_subtitle (play_base_bin, play_base_bin->suburi);
@@ -1350,6 +1344,23 @@ setup_substreams (GstPlayBaseBin * play_
   }
 }
 
+static void
+new_pad (GstElement * element, GstPad * pad, GstPlayBaseBin * bin)
+{
+  GST_DEBUG_OBJECT (bin, "Found new pad %s.%s in source element.",
+      GST_DEBUG_PAD_NAME (pad));
+  if (!gst_element_link (bin->source, bin->decoder))
+    goto could_not_link;
+  return;
+
+could_not_link:
+ {
+   GST_ELEMENT_ERROR (bin, CORE, NEGOTIATION,
+       (NULL), ("Can't link source to decoder element"));
+   return;
+ }
+}
+
 /* construct and run the source and decoder elements until we found
  * all the streams or until a preroll queue has been filled.
 */
@@ -1447,12 +1458,12 @@ setup_source (GstPlayBaseBin * play_base
    * Also check that is has source pads, if not, we assume it will
    * do everything itself.
    */
-  {
+  if (play_base_bin->source->numsrcpads > 0) {
     GstIterator *pads_iter;
     gboolean done = FALSE;
-    gboolean no_out = TRUE, is_raw = FALSE;
+    gboolean is_raw = FALSE;
 
-    pads_iter = gst_element_iterate_pads (play_base_bin->source);
+    pads_iter = gst_element_iterate_src_pads (play_base_bin->source);
     while (!done) {
       gpointer data;
 
@@ -1468,11 +1479,6 @@ setup_source (GstPlayBaseBin * play_base
           GstPad *pad = GST_PAD (data);
           guint i, num_raw = 0;
 
-          if (GST_PAD_IS_SINK (pad))
-            break;
-
-          no_out = FALSE;
-
           caps = gst_pad_get_caps (pad);
           if (caps == NULL || gst_caps_is_empty (caps) ||
               gst_caps_get_size (caps) == 0) {
@@ -1513,15 +1519,10 @@ setup_source (GstPlayBaseBin * play_base
       no_more_pads (play_base_bin->source, play_base_bin);
       return TRUE;
     }
-#if 0
-    if (no_out) {
-      /* create a stream to indicate that this uri is handled by a self
-       * contained element */
-      add_element_stream (play_base_bin->source, play_base_bin);
-      no_more_pads (play_base_bin->source, play_base_bin);
-      return TRUE;
-    }
-#endif
+  } else {
+    play_base_bin->np_sig_id = g_signal_connect (
+        G_OBJECT (play_base_bin->source), "pad-added",
+        G_CALLBACK (new_pad), play_base_bin);
   }
 
   /* now create the decoder element */
@@ -1536,7 +1537,8 @@ setup_source (GstPlayBaseBin * play_base
 
   gst_bin_add (GST_BIN (play_base_bin), play_base_bin->decoder);
 
-  if (!gst_element_link (play_base_bin->source, play_base_bin->decoder))
+  if (!play_base_bin->np_sig_id &&
+      !gst_element_link (play_base_bin->source, play_base_bin->decoder))
     goto could_not_link;
 
   /* set up callbacks to create the links between decoded data
