+2005-11-10 Wim Taymans <wim@fluendo.com>
+
+ * check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
+ Added check for bug #317341
+
+ * gst/gstbuffer.c:
+ * gst/gstbuffer.h:
+ Some more spiffifying.
+
+ * gst/gstghostpad.c: (gst_ghost_pad_do_link):
+ Call peer linkfunction if we are a source pad. Totally fixes
+ #317341
+
+ * gst/gstpad.c:
+ Update docs, source pads should call the peer linkfunction
+ so they can atomically perform the pad link.
+
2005-11-09 Wim Taymans <wim@fluendo.com>
* gst/gstbuffer.c:
#if 0
/* test if a ghost pad without a target can be linked
- *
+ * It can't because it has incompatible caps...
*/
GST_START_TEST (test_ghost_pad_notarget)
{
GST_END_TEST;
+GST_START_TEST (test_ghost_pads_bin)
+{
+ GstBin *pipeline;
+ GstBin *srcbin;
+ GstBin *sinkbin;
+ GstElement *src;
+ GstElement *sink;
+ GstPad *srcghost;
+ GstPad *sinkghost;
+
+ pipeline = GST_BIN (gst_pipeline_new ("pipe"));
+
+ srcbin = GST_BIN (gst_bin_new ("srcbin"));
+ gst_bin_add (pipeline, GST_ELEMENT (srcbin));
+
+ sinkbin = GST_BIN (gst_bin_new ("sinkbin"));
+ gst_bin_add (pipeline, GST_ELEMENT (sinkbin));
+
+ src = gst_element_factory_make ("fakesrc", "src");
+ gst_bin_add (srcbin, src);
+ srcghost = gst_ghost_pad_new ("src", gst_element_get_pad (src, "src"));
+ gst_element_add_pad (GST_ELEMENT (srcbin), srcghost);
+
+ sink = gst_element_factory_make ("fakesink", "sink");
+ gst_bin_add (sinkbin, sink);
+ sinkghost = gst_ghost_pad_new ("sink", gst_element_get_pad (sink, "sink"));
+ gst_element_add_pad (GST_ELEMENT (sinkbin), sinkghost);
+
+ gst_element_link (GST_ELEMENT (srcbin), GST_ELEMENT (sinkbin));
+
+ fail_unless (GST_PAD_PEER (srcghost) != NULL);
+ fail_unless (GST_PAD_PEER (sinkghost) != NULL);
+ fail_unless (GST_PAD_PEER (gst_ghost_pad_get_target (GST_GHOST_PAD
+ (srcghost))) != NULL);
+ fail_unless (GST_PAD_PEER (gst_ghost_pad_get_target (GST_GHOST_PAD
+ (sinkghost))) != NULL);
+}
+
+GST_END_TEST;
+
Suite *
gst_ghost_pad_suite (void)
{
tcase_add_test (tc_chain, test_remove2);
tcase_add_test (tc_chain, test_link);
tcase_add_test (tc_chain, test_ghost_pads);
+ tcase_add_test (tc_chain, test_ghost_pads_bin);
/* tcase_add_test (tc_chain, test_ghost_pad_notarget); */
return s;
* @short_description: Data-passing buffer type, supporting sub-buffers.
* @see_also: #GstPad, #GstMiniObject
*
- * Buffers are the basic unit of data transfer in GStreamer. The GstBuffer type
+ * Buffers are the basic unit of data transfer in GStreamer. The #GstBuffer type
* provides all the state necessary to define a region of memory as part of a
* stream. Sub-buffers are also supported, allowing a smaller region of a
* buffer to become its own buffer, with mechanisms in place to ensure that
* @mini_object: the parent structure
* @data: pointer to the buffer data
* @size: size of buffer data
- * @timestamp: timestamp of the buffer, can be GST_CLOCK_TIME_NONE when the
+ * @timestamp: timestamp of the buffer, can be #GST_CLOCK_TIME_NONE when the
* timestamp is not known or relevant.
- * @duration: duration in time of the buffer data, can be GST_CLOCK_TIME_NONE
+ * @duration: duration in time of the buffer data, can be #GST_CLOCK_TIME_NONE
* when the duration is not known or relevant.
* @caps: the #GstCaps describing the data format in this buffer
* @offset: a media specific offset for the buffer data.
else
ret = gst_pad_link (target, internal);
+ /* if we are a source pad, we should call the peer link function
+ * if the peer has one */
+ if (GST_PAD_IS_SRC (pad)) {
+ if (GST_PAD_LINKFUNC (peer) && ret == GST_PAD_LINK_OK)
+ ret = GST_PAD_LINKFUNC (peer) (peer, pad);
+ }
+
gst_object_unref (target);
if (ret == GST_PAD_LINK_OK)
* Sets the given link function for the pad. It will be called when
* the pad is linked with another pad.
*
- * The return value GST_PAD_LINK_OK should be used when the connection can be
+ * The return value #GST_PAD_LINK_OK should be used when the connection can be
* made.
*
- * The return value GST_PAD_LINK_REFUSED should be used when the connection
+ * The return value #GST_PAD_LINK_REFUSED should be used when the connection
* cannot be made for some reason.
+ *
+ * If @link is installed on a source pad, it should call the #GstPadLinkFunction
+ * of the peer sink pad, if present.
*/
void
gst_pad_set_link_function (GstPad * pad, GstPadLinkFunction link)
#if 0
/* test if a ghost pad without a target can be linked
- *
+ * It can't because it has incompatible caps...
*/
GST_START_TEST (test_ghost_pad_notarget)
{
GST_END_TEST;
+GST_START_TEST (test_ghost_pads_bin)
+{
+ GstBin *pipeline;
+ GstBin *srcbin;
+ GstBin *sinkbin;
+ GstElement *src;
+ GstElement *sink;
+ GstPad *srcghost;
+ GstPad *sinkghost;
+
+ pipeline = GST_BIN (gst_pipeline_new ("pipe"));
+
+ srcbin = GST_BIN (gst_bin_new ("srcbin"));
+ gst_bin_add (pipeline, GST_ELEMENT (srcbin));
+
+ sinkbin = GST_BIN (gst_bin_new ("sinkbin"));
+ gst_bin_add (pipeline, GST_ELEMENT (sinkbin));
+
+ src = gst_element_factory_make ("fakesrc", "src");
+ gst_bin_add (srcbin, src);
+ srcghost = gst_ghost_pad_new ("src", gst_element_get_pad (src, "src"));
+ gst_element_add_pad (GST_ELEMENT (srcbin), srcghost);
+
+ sink = gst_element_factory_make ("fakesink", "sink");
+ gst_bin_add (sinkbin, sink);
+ sinkghost = gst_ghost_pad_new ("sink", gst_element_get_pad (sink, "sink"));
+ gst_element_add_pad (GST_ELEMENT (sinkbin), sinkghost);
+
+ gst_element_link (GST_ELEMENT (srcbin), GST_ELEMENT (sinkbin));
+
+ fail_unless (GST_PAD_PEER (srcghost) != NULL);
+ fail_unless (GST_PAD_PEER (sinkghost) != NULL);
+ fail_unless (GST_PAD_PEER (gst_ghost_pad_get_target (GST_GHOST_PAD
+ (srcghost))) != NULL);
+ fail_unless (GST_PAD_PEER (gst_ghost_pad_get_target (GST_GHOST_PAD
+ (sinkghost))) != NULL);
+}
+
+GST_END_TEST;
+
Suite *
gst_ghost_pad_suite (void)
{
tcase_add_test (tc_chain, test_remove2);
tcase_add_test (tc_chain, test_link);
tcase_add_test (tc_chain, test_ghost_pads);
+ tcase_add_test (tc_chain, test_ghost_pads_bin);
/* tcase_add_test (tc_chain, test_ghost_pad_notarget); */
return s;