gst/playback/: Fix the case where we try to ref a NULL element when we delay a link...
authorWim Taymans <wim.taymans@gmail.com>
Wed, 10 Jan 2007 16:08:18 +0000 (16:08 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Wed, 10 Jan 2007 16:08:18 +0000 (16:08 +0000)
Original commit message from CVS:
* gst/playback/gstdecodebin.c: (dynamic_add), (close_pad_link),
(is_demuxer_element), (new_caps):
* gst/playback/gstplaybasebin.c: (source_new_pad):
Fix the case where we try to ref a NULL element when we delay a link
because of unfixed caps.
Set the state of autoplugged decodebins to PAUSED.
RTSP now works in playbin, we can remove it from the blacklist.

ChangeLog
gst/playback/gstdecodebin.c
gst/playback/gstplaybasebin.c

index e4ed9c5..8768e4c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-01-10  Wim Taymans  <wim@fluendo.com>
+
+       * gst/playback/gstdecodebin.c: (dynamic_add), (close_pad_link),
+       (is_demuxer_element), (new_caps):
+       * gst/playback/gstplaybasebin.c: (source_new_pad):
+       Fix the case where we try to ref a NULL element when we delay a link
+       because of unfixed caps.
+       Set the state of autoplugged decodebins to PAUSED.
+       RTSP now works in playbin, we can remove it from the blacklist.
+
 2007-01-09  Tim-Philipp Müller  <tim at centricular dot net>
 
        * gst/playback/Makefile.am:
index 314468e..47d2844 100644 (file)
@@ -409,7 +409,7 @@ dynamic_add (GstElement * element, GstPad * pad, GstDecodeBin * decode_bin)
   struct DynFind find_info;
   GList *found;
 
-  g_return_if_fail (element != NULL || pad != NULL);
+  g_return_if_fail (element != NULL);
 
   /* do a search that this entry doesn't already exist */
   find_info.elem = element;
@@ -421,25 +421,21 @@ dynamic_add (GstElement * element, GstPad * pad, GstDecodeBin * decode_bin)
 
   /* take refs */
   dyn = g_new0 (GstDynamic, 1);
-  dyn->element = element;
-  dyn->pad = pad;
+  dyn->element = gst_object_ref (element);
   dyn->decode_bin = gst_object_ref (decode_bin);
-  if (element) {
+  if (pad) {
+    dyn->pad = gst_object_ref (pad);
+    GST_DEBUG_OBJECT (decode_bin, "dynamic create for pad %" GST_PTR_FORMAT,
+        pad);
+    dyn->caps_sig_id = g_signal_connect (G_OBJECT (pad), "notify::caps",
+        G_CALLBACK (new_caps), dyn);
+  } else {
     GST_DEBUG_OBJECT (decode_bin, "dynamic create for element %"
         GST_PTR_FORMAT, element);
-
-    gst_object_ref (element);
     dyn->np_sig_id = g_signal_connect (G_OBJECT (element), "pad-added",
         G_CALLBACK (new_pad), dyn);
     dyn->nmp_sig_id = g_signal_connect (G_OBJECT (element), "no-more-pads",
         G_CALLBACK (no_more_pads), dyn);
-  } else {
-    GST_DEBUG_OBJECT (decode_bin, "dynamic create for pad %" GST_PTR_FORMAT,
-        pad);
-
-    gst_object_ref (pad);
-    dyn->caps_sig_id = g_signal_connect (G_OBJECT (pad), "notify::caps",
-        G_CALLBACK (new_caps), dyn);
   }
 
   /* and add this element to the dynamic elements */
@@ -794,7 +790,7 @@ many_types:
 setup_caps_delay:
   {
     GST_LOG_OBJECT (pad, "setting up a delayed link");
-    dynamic_add (NULL, pad, decode_bin);
+    dynamic_add (element, pad, decode_bin);
     return;
   }
 }
@@ -814,7 +810,7 @@ is_demuxer_element (GstElement * srcelement)
   klass = gst_element_factory_get_klass (srcfactory);
 
   /* Can't be a demuxer unless it has Demux in the klass name */
-  if (!strstr (klass, "Demux"))
+  if (klass == NULL || !strstr (klass, "Demux"))
     return FALSE;
 
   /* Walk the src pad templates and count how many the element
@@ -1311,7 +1307,7 @@ no_more_pads (GstElement * element, GstDynamic * dynamic)
 static void
 new_caps (GstPad * pad, GParamSpec * unused, GstDynamic * dynamic)
 {
-  GST_DEBUG_OBJECT (dynamic->decode_bin, "delayed link triggered\n");
+  GST_DEBUG_OBJECT (dynamic->decode_bin, "delayed link triggered");
 
   new_pad (dynamic->element, pad, dynamic);
 
index 52a34a1..9d37b6c 100644 (file)
@@ -1451,7 +1451,7 @@ static const gchar *stream_uris[] = { "http://", "mms://", "mmsh://",
 };
 
 /* blacklisted URIs, we know they will always fail. */
-static const gchar *blacklisted_uris[] = { "rtsp://", NULL };
+static const gchar *blacklisted_uris[] = { NULL };
 
 /* mime types that we don't consider to be media types */
 static const gchar *no_media_mimes[] = {
@@ -1580,6 +1580,8 @@ source_new_pad (GstElement * element, GstPad * pad, GstPlayBaseBin * bin)
   if (!gst_element_link (bin->source, decoder))
     goto could_not_link;
 
+  gst_element_set_state (decoder, GST_STATE_PAUSED);
+
   return;
 
   /* ERRORS */