Don't forward gst_pad_set_caps() on a source ghostpad to its target.
authorAlessandro Decina <alessandro.d@gmail.com>
Fri, 19 Dec 2008 15:11:06 +0000 (15:11 +0000)
committerAlessandro Decina <alessandro.d@gmail.com>
Fri, 19 Dec 2008 15:11:06 +0000 (15:11 +0000)
Original commit message from CVS:
* gst/gstghostpad.c:
* tests/check/gst/gstghostpad.c:
Don't forward gst_pad_set_caps() on a source ghostpad to its target.
That would cause the ghostpad to emit notify::caps two times (fist
from gst_pad_set_caps() and after from on_src_target_notify()).

ChangeLog
gst/gstghostpad.c
tests/check/gst/gstghostpad.c

index a0c8cee..a935a50 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-12-19  Alessandro Decina <alessandro.decina@collabora.co.uk>
+
+       * gst/gstghostpad.c:
+       * tests/check/gst/gstghostpad.c:
+       Don't forward gst_pad_set_caps() on a source ghostpad to its target.
+       That would cause the ghostpad to emit notify::caps two times (fist
+       from gst_pad_set_caps() and after from on_src_target_notify()).
+
 2008-12-19  Wim Taymans  <wim.taymans@collabora.co.uk>
 
        * tests/check/gst/gstghostpad.c: (ghost_notify_caps),
index 961e3a6..33cda52 100644 (file)
@@ -704,12 +704,23 @@ on_src_target_notify (GstPad * target, GParamSpec * unused, GstGhostPad * pad)
 
 }
 
+static gboolean
+gst_ghost_pad_do_setcaps (GstPad * pad, GstCaps * caps)
+{
+  if (GST_PAD_DIRECTION (pad) == GST_PAD_SRC)
+    return TRUE;
+
+  return gst_proxy_pad_do_setcaps (pad, caps);
+}
+
 static void
 gst_ghost_pad_init (GstGhostPad * pad)
 {
   GST_GHOST_PAD_PRIVATE (pad) = G_TYPE_INSTANCE_GET_PRIVATE (pad,
       GST_TYPE_GHOST_PAD, GstGhostPadPrivate);
 
+  gst_pad_set_setcaps_function (GST_PAD_CAST (pad),
+      GST_DEBUG_FUNCPTR (gst_ghost_pad_do_setcaps));
   gst_pad_set_activatepull_function (GST_PAD_CAST (pad),
       GST_DEBUG_FUNCPTR (gst_ghost_pad_do_activate_pull));
   gst_pad_set_activatepush_function (GST_PAD_CAST (pad),
index 258b54c..8a265fc 100644 (file)
@@ -721,7 +721,7 @@ GST_START_TEST (test_ghost_pads_forward_setcaps)
   caps1 = gst_caps_from_string ("meh");
   fail_unless (gst_pad_set_caps (ghost, caps1));
   caps2 = GST_PAD_CAPS (src);
-  fail_unless (gst_caps_is_equal (caps1, caps2));
+  fail_unless (caps2 == NULL);
   fail_unless_equals_int (notify_counter, 1);
 
   gst_object_unref (ghost);