mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
check/gst/gstghostpad.c: Added check for bug #317341
Original commit message from CVS: * 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.
This commit is contained in:
parent
67e2017f50
commit
8bf3884cbb
7 changed files with 116 additions and 7 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
||||||
|
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>
|
2005-11-09 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/gstbuffer.c:
|
* gst/gstbuffer.c:
|
||||||
|
|
|
@ -104,7 +104,7 @@ GST_END_TEST;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* test if a ghost pad without a target can be linked
|
/* 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_START_TEST (test_ghost_pad_notarget)
|
||||||
{
|
{
|
||||||
|
@ -287,6 +287,46 @@ GST_START_TEST (test_ghost_pads)
|
||||||
|
|
||||||
GST_END_TEST;
|
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 *
|
Suite *
|
||||||
gst_ghost_pad_suite (void)
|
gst_ghost_pad_suite (void)
|
||||||
{
|
{
|
||||||
|
@ -298,6 +338,7 @@ gst_ghost_pad_suite (void)
|
||||||
tcase_add_test (tc_chain, test_remove2);
|
tcase_add_test (tc_chain, test_remove2);
|
||||||
tcase_add_test (tc_chain, test_link);
|
tcase_add_test (tc_chain, test_link);
|
||||||
tcase_add_test (tc_chain, test_ghost_pads);
|
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); */
|
/* tcase_add_test (tc_chain, test_ghost_pad_notarget); */
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @short_description: Data-passing buffer type, supporting sub-buffers.
|
* @short_description: Data-passing buffer type, supporting sub-buffers.
|
||||||
* @see_also: #GstPad, #GstMiniObject
|
* @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
|
* 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
|
* 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
|
* buffer to become its own buffer, with mechanisms in place to ensure that
|
||||||
|
|
|
@ -209,9 +209,9 @@ typedef enum {
|
||||||
* @mini_object: the parent structure
|
* @mini_object: the parent structure
|
||||||
* @data: pointer to the buffer data
|
* @data: pointer to the buffer data
|
||||||
* @size: size of 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.
|
* 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.
|
* when the duration is not known or relevant.
|
||||||
* @caps: the #GstCaps describing the data format in this buffer
|
* @caps: the #GstCaps describing the data format in this buffer
|
||||||
* @offset: a media specific offset for the buffer data.
|
* @offset: a media specific offset for the buffer data.
|
||||||
|
|
|
@ -615,6 +615,13 @@ gst_ghost_pad_do_link (GstPad * pad, GstPad * peer)
|
||||||
else
|
else
|
||||||
ret = gst_pad_link (target, internal);
|
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);
|
gst_object_unref (target);
|
||||||
|
|
||||||
if (ret == GST_PAD_LINK_OK)
|
if (ret == GST_PAD_LINK_OK)
|
||||||
|
|
|
@ -1208,11 +1208,14 @@ gst_pad_set_internal_link_function (GstPad * pad, GstPadIntLinkFunction intlink)
|
||||||
* Sets the given link function for the pad. It will be called when
|
* Sets the given link function for the pad. It will be called when
|
||||||
* the pad is linked with another pad.
|
* 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.
|
* 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.
|
* 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
|
void
|
||||||
gst_pad_set_link_function (GstPad * pad, GstPadLinkFunction link)
|
gst_pad_set_link_function (GstPad * pad, GstPadLinkFunction link)
|
||||||
|
|
|
@ -104,7 +104,7 @@ GST_END_TEST;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* test if a ghost pad without a target can be linked
|
/* 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_START_TEST (test_ghost_pad_notarget)
|
||||||
{
|
{
|
||||||
|
@ -287,6 +287,46 @@ GST_START_TEST (test_ghost_pads)
|
||||||
|
|
||||||
GST_END_TEST;
|
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 *
|
Suite *
|
||||||
gst_ghost_pad_suite (void)
|
gst_ghost_pad_suite (void)
|
||||||
{
|
{
|
||||||
|
@ -298,6 +338,7 @@ gst_ghost_pad_suite (void)
|
||||||
tcase_add_test (tc_chain, test_remove2);
|
tcase_add_test (tc_chain, test_remove2);
|
||||||
tcase_add_test (tc_chain, test_link);
|
tcase_add_test (tc_chain, test_link);
|
||||||
tcase_add_test (tc_chain, test_ghost_pads);
|
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); */
|
/* tcase_add_test (tc_chain, test_ghost_pad_notarget); */
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
Loading…
Reference in a new issue