wtay gstreamer: gstreamer/ gstreamer/tests/check/gst/

[email protected] Fri, 19 Dec 2008 03:24:50 -0800 (PST)
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gstreamer
Changes by:     wtay
Date:           Fri Dec 19 2008  11:24:50 UTC

Log message:
* tests/check/gst/gstghostpad.c: (ghost_notify_caps),
(GST_START_TEST):
Add some more unit-tests for the ghostpad notify signal, one of which
currently fails.

Modified files:
    .               : ChangeLog
    tests/check/gst : gstghostpad.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4202&r2=1.4203
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/tests/check/gst/gstghostpad.c.diff?r1=1.31&r2=1.32

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v
retrieving revision 1.4202
retrieving revision 1.4203
diff -u -d -r1.4202 -r1.4203
--- ChangeLog	19 Dec 2008 09:44:46 -0000	1.4202
+++ ChangeLog	19 Dec 2008 11:24:33 -0000	1.4203
@@ -1,3 +1,10 @@
+2008-12-19  Wim Taymans  <[email protected]>
+
+	* tests/check/gst/gstghostpad.c: (ghost_notify_caps),
+	(GST_START_TEST):
+	Add some more unit-tests for the ghostpad notify signal, one of which
+	currently fails.
 2008-12-19  Sebastian Dröge  <[email protected]>
 
 	* win32/common/libgstreamer.def:
Index: gstghostpad.c
RCS file: /cvs/gstreamer/gstreamer/tests/check/gst/gstghostpad.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- gstghostpad.c	17 Dec 2008 16:16:45 -0000	1.31
+++ gstghostpad.c	19 Dec 2008 11:24:36 -0000	1.32
@@ -671,6 +671,7 @@
 static void
 ghost_notify_caps (GObject * object, GParamSpec * pspec, gpointer * user_data)
 {
+  GST_DEBUG ("caps notify called");
   (*(gint *) user_data)++;
 }
@@ -691,7 +692,8 @@
   src = gst_pad_new_from_template (src_template, "src");
   sink = gst_pad_new_from_template (sink_template, "sink");
-  /* ghost source pad */
+  /* ghost source pad, setting caps on the source influences the caps of the
+   * ghostpad. */
   ghost = gst_ghost_pad_new ("ghostsrc", src);
   g_signal_connect (ghost, "notify::caps",
       G_CALLBACK (ghost_notify_caps), &notify_counter);
@@ -706,7 +708,28 @@
   gst_object_unref (ghost);
   gst_caps_unref (caps1);
-  /* ghost sink pad */
+  fail_unless (gst_pad_set_caps (src, NULL));
+  /* source 2, setting the caps on the ghostpad does not influence the caps of
+   * the target */
+  notify_counter = 0;
+  ghost = gst_ghost_pad_new ("ghostsrc", src);
+  g_signal_connect (ghost, "notify::caps",
+      G_CALLBACK (ghost_notify_caps), &notify_counter);
+  fail_unless (gst_pad_link (ghost, sink) == GST_PAD_LINK_OK);
+  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_equals_int (notify_counter, 1);
+  gst_object_unref (ghost);
+  gst_caps_unref (caps1);
+  /* ghost sink pad. Setting caps on the ghostpad will also set those caps on
+   * the target pad. */
   notify_counter = 0;
   ghost = gst_ghost_pad_new ("ghostsink", sink);
@@ -719,6 +742,26 @@
   fail_unless (gst_caps_is_equal (caps1, caps2));
   fail_unless_equals_int (notify_counter, 1);
+  /* sink pad 2, setting caps just on the target pad should not influence the caps
+   * on the ghostpad. */
+  ghost = gst_ghost_pad_new ("ghostsink", sink);
+  fail_unless (gst_pad_link (src, ghost) == GST_PAD_LINK_OK);
+  caps1 = gst_caps_from_string ("muh");
+  fail_unless (gst_pad_set_caps (sink, caps1));
+  caps2 = GST_PAD_CAPS (ghost);
+  fail_unless (caps2 == NULL);
+  fail_unless_equals_int (notify_counter, 0);
   gst_object_unref (src);
   gst_object_unref (sink);
   gst_object_unref (src_template);

------------------------------------------------------------------------------

_______________________________________________
gstreamer-cvs-verbose mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose