gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
|
|
|
|
*
|
|
|
|
* gstghostpad.c: Unit test for GstGhostPad
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 20:44:48 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
*/
|
2017-11-24 12:41:20 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
|
2005-08-20 12:14:28 +00:00
|
|
|
#include <gst/check/gstcheck.h>
|
2016-02-17 10:02:34 +00:00
|
|
|
#include <gst/check/gstharness.h>
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
|
2005-09-06 18:18:48 +00:00
|
|
|
/* test if removing a bin also cleans up the ghostpads
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
*/
|
|
|
|
GST_START_TEST (test_remove1)
|
|
|
|
{
|
|
|
|
GstElement *b1, *b2, *src, *sink;
|
|
|
|
GstPad *srcpad, *sinkpad;
|
|
|
|
GstPadLinkReturn ret;
|
|
|
|
|
|
|
|
b1 = gst_element_factory_make ("pipeline", NULL);
|
|
|
|
b2 = gst_element_factory_make ("bin", NULL);
|
|
|
|
src = gst_element_factory_make ("fakesrc", NULL);
|
|
|
|
sink = gst_element_factory_make ("fakesink", NULL);
|
2006-04-29 00:33:44 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (b1, "pipeline", 1);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (b2, "bin", 1);
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b2), sink));
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b1), src));
|
2006-04-29 00:33:44 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (b1, "pipeline", 1);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (b2, "bin", 1);
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
fail_unless (gst_bin_add (GST_BIN (b1), b2));
|
2007-08-16 11:04:40 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (b1, "pipeline", 1);
|
2006-04-29 00:33:44 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (b2, "bin", 1);
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
|
2008-05-21 15:57:52 +00:00
|
|
|
sinkpad = gst_element_get_static_pad (sink, "sink");
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
gst_element_add_pad (b2, gst_ghost_pad_new ("sink", sinkpad));
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
|
2008-05-21 15:57:52 +00:00
|
|
|
srcpad = gst_element_get_static_pad (src, "src");
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
/* get the ghostpad */
|
2008-05-21 15:57:52 +00:00
|
|
|
sinkpad = gst_element_get_static_pad (b2, "sink");
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
|
|
|
|
ret = gst_pad_link (srcpad, sinkpad);
|
|
|
|
fail_unless (ret == GST_PAD_LINK_OK);
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
|
2006-04-29 00:33:44 +00:00
|
|
|
/* now remove the bin with the ghostpad, b2 is disposed now. */
|
2007-08-16 11:04:40 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (b1, "pipeline", 1);
|
2006-04-29 00:33:44 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (b2, "bin", 1);
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
gst_bin_remove (GST_BIN (b1), b2);
|
|
|
|
|
2008-05-21 15:57:52 +00:00
|
|
|
srcpad = gst_element_get_static_pad (src, "src");
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
/* pad cannot be linked now */
|
|
|
|
fail_if (gst_pad_is_linked (srcpad));
|
2006-04-05 15:12:39 +00:00
|
|
|
gst_object_unref (srcpad);
|
2006-01-28 00:59:37 +00:00
|
|
|
|
2006-04-29 00:33:44 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (b1, "pipeline", 1);
|
2006-01-28 00:59:37 +00:00
|
|
|
gst_object_unref (b1);
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2005-09-06 18:18:48 +00:00
|
|
|
/* test if removing a bin also cleans up the ghostpads
|
check/gst/gstghostpad.c: Added test for removing an element with ghostpad from a bin.
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added test for removing an element with ghostpad from a bin.
Fixed test as current implementation does the right thing.
* gst/gstghostpad.c: (gst_proxy_pad_class_init),
(gst_proxy_pad_do_query_type), (gst_proxy_pad_do_event),
(gst_proxy_pad_do_query), (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_do_bufferalloc), (gst_proxy_pad_do_activate),
(gst_proxy_pad_do_activatepull), (gst_proxy_pad_do_activatepush),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target),
(gst_proxy_pad_get_target), (gst_proxy_pad_init),
(gst_proxy_pad_dispose), (gst_proxy_pad_finalize),
(gst_ghost_pad_class_init), (gst_ghost_pad_do_activate_push),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_set_internal), (gst_ghost_pad_dispose),
(gst_ghost_pad_new_notarget), (gst_ghost_pad_new),
(gst_ghost_pad_get_target), (gst_ghost_pad_set_target):
* gst/gstghostpad.h:
Clean up ghostpads, remove properties for internal stuff.
Make threadsafe.
Fix refcounting.
Prepare for switching targets, not all use cases work yet.
2005-07-29 19:22:28 +00:00
|
|
|
*/
|
|
|
|
GST_START_TEST (test_remove2)
|
|
|
|
{
|
|
|
|
GstElement *b1, *b2, *src, *sink;
|
|
|
|
GstPad *srcpad, *sinkpad;
|
|
|
|
GstPadLinkReturn ret;
|
|
|
|
|
|
|
|
b1 = gst_element_factory_make ("pipeline", NULL);
|
|
|
|
b2 = gst_element_factory_make ("bin", NULL);
|
|
|
|
src = gst_element_factory_make ("fakesrc", NULL);
|
|
|
|
sink = gst_element_factory_make ("fakesink", NULL);
|
2006-04-29 00:33:44 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (src, "src", 1);
|
check/gst/gstghostpad.c: Added test for removing an element with ghostpad from a bin.
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added test for removing an element with ghostpad from a bin.
Fixed test as current implementation does the right thing.
* gst/gstghostpad.c: (gst_proxy_pad_class_init),
(gst_proxy_pad_do_query_type), (gst_proxy_pad_do_event),
(gst_proxy_pad_do_query), (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_do_bufferalloc), (gst_proxy_pad_do_activate),
(gst_proxy_pad_do_activatepull), (gst_proxy_pad_do_activatepush),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target),
(gst_proxy_pad_get_target), (gst_proxy_pad_init),
(gst_proxy_pad_dispose), (gst_proxy_pad_finalize),
(gst_ghost_pad_class_init), (gst_ghost_pad_do_activate_push),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_set_internal), (gst_ghost_pad_dispose),
(gst_ghost_pad_new_notarget), (gst_ghost_pad_new),
(gst_ghost_pad_get_target), (gst_ghost_pad_set_target):
* gst/gstghostpad.h:
Clean up ghostpads, remove properties for internal stuff.
Make threadsafe.
Fix refcounting.
Prepare for switching targets, not all use cases work yet.
2005-07-29 19:22:28 +00:00
|
|
|
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b2), sink));
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b1), src));
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b1), b2));
|
2006-04-29 00:33:44 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (src, "src", 1);
|
check/gst/gstghostpad.c: Added test for removing an element with ghostpad from a bin.
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added test for removing an element with ghostpad from a bin.
Fixed test as current implementation does the right thing.
* gst/gstghostpad.c: (gst_proxy_pad_class_init),
(gst_proxy_pad_do_query_type), (gst_proxy_pad_do_event),
(gst_proxy_pad_do_query), (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_do_bufferalloc), (gst_proxy_pad_do_activate),
(gst_proxy_pad_do_activatepull), (gst_proxy_pad_do_activatepush),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target),
(gst_proxy_pad_get_target), (gst_proxy_pad_init),
(gst_proxy_pad_dispose), (gst_proxy_pad_finalize),
(gst_ghost_pad_class_init), (gst_ghost_pad_do_activate_push),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_set_internal), (gst_ghost_pad_dispose),
(gst_ghost_pad_new_notarget), (gst_ghost_pad_new),
(gst_ghost_pad_get_target), (gst_ghost_pad_set_target):
* gst/gstghostpad.h:
Clean up ghostpads, remove properties for internal stuff.
Make threadsafe.
Fix refcounting.
Prepare for switching targets, not all use cases work yet.
2005-07-29 19:22:28 +00:00
|
|
|
|
2008-05-21 15:57:52 +00:00
|
|
|
sinkpad = gst_element_get_static_pad (sink, "sink");
|
check/gst/gstghostpad.c: Added test for removing an element with ghostpad from a bin.
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added test for removing an element with ghostpad from a bin.
Fixed test as current implementation does the right thing.
* gst/gstghostpad.c: (gst_proxy_pad_class_init),
(gst_proxy_pad_do_query_type), (gst_proxy_pad_do_event),
(gst_proxy_pad_do_query), (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_do_bufferalloc), (gst_proxy_pad_do_activate),
(gst_proxy_pad_do_activatepull), (gst_proxy_pad_do_activatepush),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target),
(gst_proxy_pad_get_target), (gst_proxy_pad_init),
(gst_proxy_pad_dispose), (gst_proxy_pad_finalize),
(gst_ghost_pad_class_init), (gst_ghost_pad_do_activate_push),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_set_internal), (gst_ghost_pad_dispose),
(gst_ghost_pad_new_notarget), (gst_ghost_pad_new),
(gst_ghost_pad_get_target), (gst_ghost_pad_set_target):
* gst/gstghostpad.h:
Clean up ghostpads, remove properties for internal stuff.
Make threadsafe.
Fix refcounting.
Prepare for switching targets, not all use cases work yet.
2005-07-29 19:22:28 +00:00
|
|
|
gst_element_add_pad (b2, gst_ghost_pad_new ("sink", sinkpad));
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
|
2008-05-21 15:57:52 +00:00
|
|
|
srcpad = gst_element_get_static_pad (src, "src");
|
2006-04-29 00:33:44 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 2); /* since we got one */
|
check/gst/gstghostpad.c: Added test for removing an element with ghostpad from a bin.
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added test for removing an element with ghostpad from a bin.
Fixed test as current implementation does the right thing.
* gst/gstghostpad.c: (gst_proxy_pad_class_init),
(gst_proxy_pad_do_query_type), (gst_proxy_pad_do_event),
(gst_proxy_pad_do_query), (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_do_bufferalloc), (gst_proxy_pad_do_activate),
(gst_proxy_pad_do_activatepull), (gst_proxy_pad_do_activatepush),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target),
(gst_proxy_pad_get_target), (gst_proxy_pad_init),
(gst_proxy_pad_dispose), (gst_proxy_pad_finalize),
(gst_ghost_pad_class_init), (gst_ghost_pad_do_activate_push),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_set_internal), (gst_ghost_pad_dispose),
(gst_ghost_pad_new_notarget), (gst_ghost_pad_new),
(gst_ghost_pad_get_target), (gst_ghost_pad_set_target):
* gst/gstghostpad.h:
Clean up ghostpads, remove properties for internal stuff.
Make threadsafe.
Fix refcounting.
Prepare for switching targets, not all use cases work yet.
2005-07-29 19:22:28 +00:00
|
|
|
/* get the ghostpad */
|
2008-05-21 15:57:52 +00:00
|
|
|
sinkpad = gst_element_get_static_pad (b2, "sink");
|
2006-04-29 00:33:44 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2); /* since we got one */
|
check/gst/gstghostpad.c: Added test for removing an element with ghostpad from a bin.
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added test for removing an element with ghostpad from a bin.
Fixed test as current implementation does the right thing.
* gst/gstghostpad.c: (gst_proxy_pad_class_init),
(gst_proxy_pad_do_query_type), (gst_proxy_pad_do_event),
(gst_proxy_pad_do_query), (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_do_bufferalloc), (gst_proxy_pad_do_activate),
(gst_proxy_pad_do_activatepull), (gst_proxy_pad_do_activatepush),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target),
(gst_proxy_pad_get_target), (gst_proxy_pad_init),
(gst_proxy_pad_dispose), (gst_proxy_pad_finalize),
(gst_ghost_pad_class_init), (gst_ghost_pad_do_activate_push),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_set_internal), (gst_ghost_pad_dispose),
(gst_ghost_pad_new_notarget), (gst_ghost_pad_new),
(gst_ghost_pad_get_target), (gst_ghost_pad_set_target):
* gst/gstghostpad.h:
Clean up ghostpads, remove properties for internal stuff.
Make threadsafe.
Fix refcounting.
Prepare for switching targets, not all use cases work yet.
2005-07-29 19:22:28 +00:00
|
|
|
|
2006-04-29 00:33:44 +00:00
|
|
|
GST_DEBUG ("linking srcpad and sinkpad");
|
check/gst/gstghostpad.c: Added test for removing an element with ghostpad from a bin.
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added test for removing an element with ghostpad from a bin.
Fixed test as current implementation does the right thing.
* gst/gstghostpad.c: (gst_proxy_pad_class_init),
(gst_proxy_pad_do_query_type), (gst_proxy_pad_do_event),
(gst_proxy_pad_do_query), (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_do_bufferalloc), (gst_proxy_pad_do_activate),
(gst_proxy_pad_do_activatepull), (gst_proxy_pad_do_activatepush),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target),
(gst_proxy_pad_get_target), (gst_proxy_pad_init),
(gst_proxy_pad_dispose), (gst_proxy_pad_finalize),
(gst_ghost_pad_class_init), (gst_ghost_pad_do_activate_push),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_set_internal), (gst_ghost_pad_dispose),
(gst_ghost_pad_new_notarget), (gst_ghost_pad_new),
(gst_ghost_pad_get_target), (gst_ghost_pad_set_target):
* gst/gstghostpad.h:
Clean up ghostpads, remove properties for internal stuff.
Make threadsafe.
Fix refcounting.
Prepare for switching targets, not all use cases work yet.
2005-07-29 19:22:28 +00:00
|
|
|
ret = gst_pad_link (srcpad, sinkpad);
|
2006-04-29 00:33:44 +00:00
|
|
|
GST_DEBUG ("linked srcpad and sinkpad");
|
check/gst/gstghostpad.c: Added test for removing an element with ghostpad from a bin.
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added test for removing an element with ghostpad from a bin.
Fixed test as current implementation does the right thing.
* gst/gstghostpad.c: (gst_proxy_pad_class_init),
(gst_proxy_pad_do_query_type), (gst_proxy_pad_do_event),
(gst_proxy_pad_do_query), (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_do_bufferalloc), (gst_proxy_pad_do_activate),
(gst_proxy_pad_do_activatepull), (gst_proxy_pad_do_activatepush),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target),
(gst_proxy_pad_get_target), (gst_proxy_pad_init),
(gst_proxy_pad_dispose), (gst_proxy_pad_finalize),
(gst_ghost_pad_class_init), (gst_ghost_pad_do_activate_push),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_set_internal), (gst_ghost_pad_dispose),
(gst_ghost_pad_new_notarget), (gst_ghost_pad_new),
(gst_ghost_pad_get_target), (gst_ghost_pad_set_target):
* gst/gstghostpad.h:
Clean up ghostpads, remove properties for internal stuff.
Make threadsafe.
Fix refcounting.
Prepare for switching targets, not all use cases work yet.
2005-07-29 19:22:28 +00:00
|
|
|
fail_unless (ret == GST_PAD_LINK_OK);
|
2011-10-25 21:26:50 +00:00
|
|
|
/* Refcount should be unchanged, targets are now decuced using peer pad */
|
|
|
|
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 2);
|
2006-04-29 00:33:44 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
|
check/gst/gstghostpad.c: Added test for removing an element with ghostpad from a bin.
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added test for removing an element with ghostpad from a bin.
Fixed test as current implementation does the right thing.
* gst/gstghostpad.c: (gst_proxy_pad_class_init),
(gst_proxy_pad_do_query_type), (gst_proxy_pad_do_event),
(gst_proxy_pad_do_query), (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_do_bufferalloc), (gst_proxy_pad_do_activate),
(gst_proxy_pad_do_activatepull), (gst_proxy_pad_do_activatepush),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target),
(gst_proxy_pad_get_target), (gst_proxy_pad_init),
(gst_proxy_pad_dispose), (gst_proxy_pad_finalize),
(gst_ghost_pad_class_init), (gst_ghost_pad_do_activate_push),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_set_internal), (gst_ghost_pad_dispose),
(gst_ghost_pad_new_notarget), (gst_ghost_pad_new),
(gst_ghost_pad_get_target), (gst_ghost_pad_set_target):
* gst/gstghostpad.h:
Clean up ghostpads, remove properties for internal stuff.
Make threadsafe.
Fix refcounting.
Prepare for switching targets, not all use cases work yet.
2005-07-29 19:22:28 +00:00
|
|
|
gst_object_unref (srcpad);
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
|
|
|
|
/* now remove the sink from the bin */
|
|
|
|
gst_bin_remove (GST_BIN (b2), sink);
|
|
|
|
|
2008-05-21 15:57:52 +00:00
|
|
|
srcpad = gst_element_get_static_pad (src, "src");
|
check/gst/gstghostpad.c: Added test for removing an element with ghostpad from a bin.
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added test for removing an element with ghostpad from a bin.
Fixed test as current implementation does the right thing.
* gst/gstghostpad.c: (gst_proxy_pad_class_init),
(gst_proxy_pad_do_query_type), (gst_proxy_pad_do_event),
(gst_proxy_pad_do_query), (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_do_bufferalloc), (gst_proxy_pad_do_activate),
(gst_proxy_pad_do_activatepull), (gst_proxy_pad_do_activatepush),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target),
(gst_proxy_pad_get_target), (gst_proxy_pad_init),
(gst_proxy_pad_dispose), (gst_proxy_pad_finalize),
(gst_ghost_pad_class_init), (gst_ghost_pad_do_activate_push),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_set_internal), (gst_ghost_pad_dispose),
(gst_ghost_pad_new_notarget), (gst_ghost_pad_new),
(gst_ghost_pad_get_target), (gst_ghost_pad_set_target):
* gst/gstghostpad.h:
Clean up ghostpads, remove properties for internal stuff.
Make threadsafe.
Fix refcounting.
Prepare for switching targets, not all use cases work yet.
2005-07-29 19:22:28 +00:00
|
|
|
/* pad is still linked to ghostpad */
|
|
|
|
fail_if (!gst_pad_is_linked (srcpad));
|
2006-04-29 00:33:44 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (src, "src", 1);
|
2011-10-25 21:26:50 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 2);
|
2006-04-29 00:33:44 +00:00
|
|
|
gst_object_unref (srcpad);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 1);
|
|
|
|
|
|
|
|
/* cleanup */
|
|
|
|
/* now unlink the pads */
|
|
|
|
gst_pad_unlink (srcpad, sinkpad);
|
2011-10-25 21:26:50 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1); /* we dropped our ref */
|
2006-04-29 00:33:44 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 1);
|
|
|
|
|
|
|
|
ASSERT_OBJECT_REFCOUNT (src, "src", 1);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (b2, "bin", 1);
|
|
|
|
/* remove b2 from b1 */
|
|
|
|
gst_bin_remove (GST_BIN (b1), b2);
|
|
|
|
|
|
|
|
/* flush the message, dropping the b1 refcount to 1 */
|
|
|
|
gst_element_set_state (b1, GST_STATE_READY);
|
|
|
|
gst_element_set_state (b1, GST_STATE_NULL);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (b1, "pipeline", 1);
|
|
|
|
gst_object_unref (b1);
|
check/gst/gstghostpad.c: Added test for removing an element with ghostpad from a bin.
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added test for removing an element with ghostpad from a bin.
Fixed test as current implementation does the right thing.
* gst/gstghostpad.c: (gst_proxy_pad_class_init),
(gst_proxy_pad_do_query_type), (gst_proxy_pad_do_event),
(gst_proxy_pad_do_query), (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_do_bufferalloc), (gst_proxy_pad_do_activate),
(gst_proxy_pad_do_activatepull), (gst_proxy_pad_do_activatepush),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target),
(gst_proxy_pad_get_target), (gst_proxy_pad_init),
(gst_proxy_pad_dispose), (gst_proxy_pad_finalize),
(gst_ghost_pad_class_init), (gst_ghost_pad_do_activate_push),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_set_internal), (gst_ghost_pad_dispose),
(gst_ghost_pad_new_notarget), (gst_ghost_pad_new),
(gst_ghost_pad_get_target), (gst_ghost_pad_set_target):
* gst/gstghostpad.h:
Clean up ghostpads, remove properties for internal stuff.
Make threadsafe.
Fix refcounting.
Prepare for switching targets, not all use cases work yet.
2005-07-29 19:22:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2009-02-16 11:58:34 +00:00
|
|
|
|
|
|
|
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
/* test if a ghost pad without a target can be linked and
|
|
|
|
* unlinked. An untargeted ghostpad has a default ANY caps unless there
|
|
|
|
* is a padtemplate that says something else.
|
2005-09-06 18:18:48 +00:00
|
|
|
*/
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
GST_START_TEST (test_ghost_pads_notarget)
|
2005-09-06 18:18:48 +00:00
|
|
|
{
|
|
|
|
GstElement *b1, *b2, *sink;
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
GstPad *srcpad, *sinkpad, *peer;
|
2005-09-06 18:18:48 +00:00
|
|
|
GstPadLinkReturn ret;
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
gboolean bret;
|
|
|
|
GstBus *bus;
|
|
|
|
GstCaps *caps;
|
2005-09-06 18:18:48 +00:00
|
|
|
|
|
|
|
b1 = gst_element_factory_make ("pipeline", NULL);
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
|
|
|
|
/* make sure all messages are discarded */
|
|
|
|
bus = gst_pipeline_get_bus (GST_PIPELINE (b1));
|
|
|
|
gst_bus_set_flushing (bus, TRUE);
|
|
|
|
gst_object_unref (bus);
|
|
|
|
|
2005-09-06 18:18:48 +00:00
|
|
|
b2 = gst_element_factory_make ("bin", NULL);
|
|
|
|
sink = gst_element_factory_make ("fakesink", NULL);
|
|
|
|
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b1), sink));
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b1), b2));
|
|
|
|
|
2005-11-22 11:48:58 +00:00
|
|
|
srcpad = gst_ghost_pad_new_no_target ("src", GST_PAD_SRC);
|
2005-09-06 18:18:48 +00:00
|
|
|
fail_unless (srcpad != NULL);
|
2008-05-21 15:57:52 +00:00
|
|
|
sinkpad = gst_element_get_static_pad (sink, "sink");
|
2005-09-06 18:18:48 +00:00
|
|
|
fail_unless (sinkpad != NULL);
|
|
|
|
|
|
|
|
ret = gst_pad_link (srcpad, sinkpad);
|
|
|
|
fail_unless (ret == GST_PAD_LINK_OK);
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
|
|
|
|
/* check if the peers are ok */
|
|
|
|
peer = gst_pad_get_peer (srcpad);
|
|
|
|
fail_unless (peer == sinkpad);
|
|
|
|
gst_object_unref (peer);
|
|
|
|
|
|
|
|
peer = gst_pad_get_peer (sinkpad);
|
|
|
|
fail_unless (peer == srcpad);
|
|
|
|
gst_object_unref (peer);
|
|
|
|
|
|
|
|
/* check caps, untargetted pad should return ANY or the padtemplate caps
|
|
|
|
* when it was created from a template */
|
2011-11-15 15:46:37 +00:00
|
|
|
caps = gst_pad_query_caps (srcpad, NULL);
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
fail_unless (gst_caps_is_any (caps));
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
/* unlink */
|
|
|
|
bret = gst_pad_unlink (srcpad, sinkpad);
|
|
|
|
fail_unless (bret == TRUE);
|
|
|
|
|
|
|
|
/* cleanup */
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
gst_object_unref (b1);
|
2005-09-06 18:18:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2009-02-16 11:58:34 +00:00
|
|
|
/* Test that removing the target of a ghostpad properly sets the target of the
|
|
|
|
* ghostpad to NULL */
|
|
|
|
GST_START_TEST (test_remove_target)
|
|
|
|
{
|
|
|
|
GstElement *b1, *b2, *src, *sink;
|
|
|
|
GstPad *sinkpad, *ghost, *target;
|
|
|
|
|
|
|
|
b1 = gst_element_factory_make ("pipeline", NULL);
|
|
|
|
b2 = gst_element_factory_make ("bin", NULL);
|
|
|
|
src = gst_element_factory_make ("fakesrc", NULL);
|
|
|
|
sink = gst_element_factory_make ("fakesink", NULL);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (src, "src", 1);
|
|
|
|
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b2), sink));
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b1), src));
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b1), b2));
|
|
|
|
ASSERT_OBJECT_REFCOUNT (src, "src", 1);
|
|
|
|
|
|
|
|
sinkpad = gst_element_get_static_pad (sink, "sink");
|
|
|
|
gst_element_add_pad (b2, gst_ghost_pad_new ("sink", sinkpad));
|
|
|
|
|
|
|
|
ghost = gst_element_get_static_pad (b2, "sink");
|
|
|
|
|
|
|
|
target = gst_ghost_pad_get_target (GST_GHOST_PAD (ghost));
|
|
|
|
fail_unless (target == sinkpad);
|
|
|
|
gst_object_unref (target);
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
|
|
|
|
gst_bin_remove (GST_BIN (b2), sink);
|
|
|
|
|
|
|
|
target = gst_ghost_pad_get_target (GST_GHOST_PAD (ghost));
|
|
|
|
fail_unless (target == NULL);
|
|
|
|
|
|
|
|
gst_object_unref (b1);
|
2011-10-11 11:54:45 +00:00
|
|
|
gst_object_unref (ghost);
|
2009-02-16 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
/* test if linking fails over different bins using a pipeline
|
|
|
|
* like this:
|
|
|
|
*
|
|
|
|
* fakesrc num_buffers=10 ! ( fakesink )
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
GST_START_TEST (test_link)
|
|
|
|
{
|
|
|
|
GstElement *b1, *b2, *src, *sink;
|
2011-05-06 13:16:09 +00:00
|
|
|
GstPad *srcpad, *sinkpad, *gpad, *ppad, *tmp;
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
GstPadLinkReturn ret;
|
|
|
|
|
|
|
|
b1 = gst_element_factory_make ("pipeline", NULL);
|
|
|
|
b2 = gst_element_factory_make ("bin", NULL);
|
|
|
|
src = gst_element_factory_make ("fakesrc", NULL);
|
|
|
|
sink = gst_element_factory_make ("fakesink", NULL);
|
|
|
|
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b2), sink));
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b1), src));
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b1), b2));
|
|
|
|
|
2008-05-21 15:57:52 +00:00
|
|
|
srcpad = gst_element_get_static_pad (src, "src");
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
fail_unless (srcpad != NULL);
|
2008-05-21 15:57:52 +00:00
|
|
|
sinkpad = gst_element_get_static_pad (sink, "sink");
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
fail_unless (sinkpad != NULL);
|
|
|
|
|
|
|
|
/* linking in different hierarchies should fail */
|
|
|
|
ret = gst_pad_link (srcpad, sinkpad);
|
|
|
|
fail_unless (ret == GST_PAD_LINK_WRONG_HIERARCHY);
|
|
|
|
|
|
|
|
/* now setup a ghostpad */
|
|
|
|
gpad = gst_ghost_pad_new ("sink", sinkpad);
|
2011-05-06 13:16:09 +00:00
|
|
|
|
|
|
|
/* Check if the internal pads are set correctly */
|
|
|
|
ppad = GST_PAD (gst_proxy_pad_get_internal (GST_PROXY_PAD (gpad)));
|
|
|
|
fail_unless (ppad == GST_PAD_PEER (sinkpad));
|
|
|
|
tmp = GST_PAD (gst_proxy_pad_get_internal (GST_PROXY_PAD (ppad)));
|
|
|
|
fail_unless (tmp == gpad);
|
|
|
|
gst_object_unref (tmp);
|
|
|
|
gst_object_unref (ppad);
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
/* need to ref as _add_pad takes ownership */
|
|
|
|
gst_object_ref (gpad);
|
|
|
|
gst_element_add_pad (b2, gpad);
|
|
|
|
|
|
|
|
/* our new sinkpad */
|
|
|
|
sinkpad = gpad;
|
|
|
|
|
|
|
|
/* and linking should work now */
|
|
|
|
ret = gst_pad_link (srcpad, sinkpad);
|
|
|
|
fail_unless (ret == GST_PAD_LINK_OK);
|
2006-04-29 00:33:44 +00:00
|
|
|
|
|
|
|
/* flush the message, dropping the b1 refcount to 1 */
|
|
|
|
gst_element_set_state (b1, GST_STATE_READY);
|
|
|
|
gst_element_set_state (b1, GST_STATE_NULL);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (b1, "pipeline", 1);
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
gst_object_unref (b1);
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
/* test if ghostpads are created automagically when using
|
|
|
|
* gst_element_link_pads.
|
|
|
|
*
|
2005-09-06 18:18:48 +00:00
|
|
|
* fakesrc num_buffers=10 ! ( identity ) ! fakesink
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
*/
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_START_TEST (test_ghost_pads)
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
{
|
|
|
|
GstElement *b1, *b2, *src, *i1, *sink;
|
|
|
|
GstPad *gsink, *gsrc, *gisrc, *gisink, *isink, *isrc, *fsrc, *fsink;
|
2005-10-10 10:57:40 +00:00
|
|
|
GstStateChangeReturn ret;
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
|
|
|
|
b1 = gst_element_factory_make ("pipeline", NULL);
|
|
|
|
b2 = gst_element_factory_make ("bin", NULL);
|
|
|
|
src = gst_element_factory_make ("fakesrc", NULL);
|
|
|
|
g_object_set (src, "num-buffers", (int) 10, NULL);
|
|
|
|
i1 = gst_element_factory_make ("identity", NULL);
|
|
|
|
sink = gst_element_factory_make ("fakesink", NULL);
|
|
|
|
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b2), i1));
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b1), src));
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b1), b2));
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (b1), sink));
|
|
|
|
fail_unless (gst_element_link_pads (src, NULL, i1, NULL));
|
|
|
|
fail_unless (gst_element_link_pads (i1, NULL, sink, NULL));
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (b2);
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
fail_unless (b2->numsinkpads == 1);
|
|
|
|
fail_unless (GST_IS_GHOST_PAD (b2->sinkpads->data));
|
|
|
|
fail_unless (b2->numsrcpads == 1);
|
|
|
|
fail_unless (GST_IS_GHOST_PAD (b2->srcpads->data));
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (b2);
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
|
2008-05-21 15:57:52 +00:00
|
|
|
fsrc = gst_element_get_static_pad (src, "src");
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
fail_unless (fsrc != NULL);
|
2005-06-28 09:59:01 +00:00
|
|
|
gsink = GST_PAD (gst_object_ref (b2->sinkpads->data));
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
fail_unless (gsink != NULL);
|
2005-06-28 09:59:01 +00:00
|
|
|
gsrc = GST_PAD (gst_object_ref (b2->srcpads->data));
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
fail_unless (gsrc != NULL);
|
2008-05-21 15:57:52 +00:00
|
|
|
fsink = gst_element_get_static_pad (sink, "sink");
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
fail_unless (fsink != NULL);
|
|
|
|
|
2008-05-21 15:57:52 +00:00
|
|
|
isink = gst_element_get_static_pad (i1, "sink");
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
fail_unless (isink != NULL);
|
2008-05-21 15:57:52 +00:00
|
|
|
isrc = gst_element_get_static_pad (i1, "src");
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
fail_unless (isrc != NULL);
|
|
|
|
gisrc = gst_pad_get_peer (isink);
|
|
|
|
fail_unless (gisrc != NULL);
|
|
|
|
gisink = gst_pad_get_peer (isrc);
|
|
|
|
fail_unless (gisink != NULL);
|
|
|
|
|
|
|
|
/* all objects above have one refcount owned by us as well */
|
|
|
|
|
2011-10-25 21:26:50 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (fsrc, "fsrc", 2); /* parent */
|
2005-10-19 11:43:42 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (gsink, "gsink", 2); /* parent */
|
|
|
|
ASSERT_OBJECT_REFCOUNT (gsrc, "gsrc", 2); /* parent */
|
2011-10-25 21:26:50 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (fsink, "fsink", 2); /* parent */
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
|
2005-10-19 11:43:42 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (gisrc, "gisrc", 2); /* parent */
|
2011-10-25 21:26:50 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (isink, "isink", 2); /* parent */
|
2005-10-19 11:43:42 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (gisink, "gisink", 2); /* parent */
|
2011-10-25 21:26:50 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (isrc, "isrc", 2); /* parent */
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
|
2005-10-10 10:57:40 +00:00
|
|
|
ret = gst_element_set_state (b1, GST_STATE_PLAYING);
|
Use GstClockTime in _get_state() instead of GTimeVal.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
* check/gst/gstelement.c: (GST_START_TEST):
* check/gst/gstevent.c: (GST_START_TEST), (test_event):
* check/gst/gstghostpad.c: (GST_START_TEST):
* check/gst/gstpipeline.c: (GST_START_TEST):
* check/pipelines/simple_launch_lines.c: (run_pipeline):
* check/states/sinks.c: (GST_START_TEST):
* gst/elements/gsttypefindelement.c: (stop_typefinding):
* gst/gstbin.c: (gst_bin_provide_clock_func), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_recalc_state), (gst_bin_change_state_func),
(bin_bus_handler):
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_get_state), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_set_state),
(gst_element_change_state), (gst_element_change_state_func):
* gst/gstelement.h:
* gst/gstpipeline.c: (gst_pipeline_class_init), (do_pipeline_seek),
(gst_pipeline_provide_clock_func):
* gst/gstutils.c: (gst_element_link_pads_filtered):
* tools/gst-launch.c: (main):
* tools/gst-typefind.c: (main):
Use GstClockTime in _get_state() instead of GTimeVal.
Remove old code in gstutils.c
2005-10-12 12:18:48 +00:00
|
|
|
ret = gst_element_get_state (b1, NULL, NULL, GST_CLOCK_TIME_NONE);
|
2005-10-10 10:57:40 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
|
2005-10-10 10:57:40 +00:00
|
|
|
ret = gst_element_set_state (b1, GST_STATE_NULL);
|
Use GstClockTime in _get_state() instead of GTimeVal.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
* check/gst/gstelement.c: (GST_START_TEST):
* check/gst/gstevent.c: (GST_START_TEST), (test_event):
* check/gst/gstghostpad.c: (GST_START_TEST):
* check/gst/gstpipeline.c: (GST_START_TEST):
* check/pipelines/simple_launch_lines.c: (run_pipeline):
* check/states/sinks.c: (GST_START_TEST):
* gst/elements/gsttypefindelement.c: (stop_typefinding):
* gst/gstbin.c: (gst_bin_provide_clock_func), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_recalc_state), (gst_bin_change_state_func),
(bin_bus_handler):
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_get_state), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_set_state),
(gst_element_change_state), (gst_element_change_state_func):
* gst/gstelement.h:
* gst/gstpipeline.c: (gst_pipeline_class_init), (do_pipeline_seek),
(gst_pipeline_provide_clock_func):
* gst/gstutils.c: (gst_element_link_pads_filtered):
* tools/gst-launch.c: (main):
* tools/gst-typefind.c: (main):
Use GstClockTime in _get_state() instead of GTimeVal.
Remove old code in gstutils.c
2005-10-12 12:18:48 +00:00
|
|
|
ret = gst_element_get_state (b1, NULL, NULL, GST_CLOCK_TIME_NONE);
|
2005-10-10 10:57:40 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (b1);
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
/* unreffing the bin will unref all elements, which will unlink and unparent
|
|
|
|
* all pads */
|
|
|
|
|
2005-10-19 11:43:42 +00:00
|
|
|
/* wait for thread to settle down */
|
2010-01-27 00:23:07 +00:00
|
|
|
while (GST_OBJECT_REFCOUNT_VALUE (fsrc) > 1)
|
2005-10-19 11:43:42 +00:00
|
|
|
THREAD_SWITCH ();
|
|
|
|
|
gst/gstbin.c: (de)activate src pads before calling state_change on the childs.
Original commit message from CVS:
* gst/gstbin.c: (activate_pads),
(iterator_activate_fold_with_resync), (gst_bin_src_pads_activate),
(gst_bin_change_state_func):
(de)activate src pads before calling state_change on the childs.
This is to avoid the case where a src ghostpad is blocked (holding the
stream lock), which would block the deactivation of the ghostpad's
target pad.
* gst/gstghostpad.c: (gst_proxy_pad_do_query_type),
(gst_proxy_pad_do_event), (gst_proxy_pad_do_query),
(gst_proxy_pad_do_internal_link), (gst_proxy_pad_do_bufferalloc),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_set_target), (gst_proxy_pad_get_internal),
(gst_proxy_pad_dispose), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_class_init),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_no_target),
(gst_ghost_pad_new), (gst_ghost_pad_set_target):
GhostPads now create their internal GstProxyPad at creation (and not
when they're linked, as it was being done previously).
The internal and target pads are linked straight away.
The data will also travel through the other pad in order to make
pad blocking and probes non-hackish (the probe/block now really happens
on the GhostPad and not on the target).
* gst/gstpad.c: (gst_pad_set_blocked_async),
(gst_pad_link_prepare), (gst_pad_push_event):
Remove previous ghostpad cruft.
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
Remove previous ghost pad cruft.
Added more detailed debug statements.
* tests/check/gst/gstghostpad.c: (GST_START_TEST):
Fix the testsuite for refcounting changes.
The comments about who has references were correct, but the refcount
being checked wasn't the same (!?!).
2006-07-11 16:20:09 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (fsrc, "fsrc", 1);
|
2005-10-19 11:43:42 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (gsink, "gsink", 1);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (gsrc, "gsink", 1);
|
gst/gstbin.c: (de)activate src pads before calling state_change on the childs.
Original commit message from CVS:
* gst/gstbin.c: (activate_pads),
(iterator_activate_fold_with_resync), (gst_bin_src_pads_activate),
(gst_bin_change_state_func):
(de)activate src pads before calling state_change on the childs.
This is to avoid the case where a src ghostpad is blocked (holding the
stream lock), which would block the deactivation of the ghostpad's
target pad.
* gst/gstghostpad.c: (gst_proxy_pad_do_query_type),
(gst_proxy_pad_do_event), (gst_proxy_pad_do_query),
(gst_proxy_pad_do_internal_link), (gst_proxy_pad_do_bufferalloc),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_set_target), (gst_proxy_pad_get_internal),
(gst_proxy_pad_dispose), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_class_init),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_no_target),
(gst_ghost_pad_new), (gst_ghost_pad_set_target):
GhostPads now create their internal GstProxyPad at creation (and not
when they're linked, as it was being done previously).
The internal and target pads are linked straight away.
The data will also travel through the other pad in order to make
pad blocking and probes non-hackish (the probe/block now really happens
on the GhostPad and not on the target).
* gst/gstpad.c: (gst_pad_set_blocked_async),
(gst_pad_link_prepare), (gst_pad_push_event):
Remove previous ghostpad cruft.
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
Remove previous ghost pad cruft.
Added more detailed debug statements.
* tests/check/gst/gstghostpad.c: (GST_START_TEST):
Fix the testsuite for refcounting changes.
The comments about who has references were correct, but the refcount
being checked wasn't the same (!?!).
2006-07-11 16:20:09 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (fsink, "fsink", 1);
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
|
gst/gstbin.c: (de)activate src pads before calling state_change on the childs.
Original commit message from CVS:
* gst/gstbin.c: (activate_pads),
(iterator_activate_fold_with_resync), (gst_bin_src_pads_activate),
(gst_bin_change_state_func):
(de)activate src pads before calling state_change on the childs.
This is to avoid the case where a src ghostpad is blocked (holding the
stream lock), which would block the deactivation of the ghostpad's
target pad.
* gst/gstghostpad.c: (gst_proxy_pad_do_query_type),
(gst_proxy_pad_do_event), (gst_proxy_pad_do_query),
(gst_proxy_pad_do_internal_link), (gst_proxy_pad_do_bufferalloc),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_set_target), (gst_proxy_pad_get_internal),
(gst_proxy_pad_dispose), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_class_init),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_no_target),
(gst_ghost_pad_new), (gst_ghost_pad_set_target):
GhostPads now create their internal GstProxyPad at creation (and not
when they're linked, as it was being done previously).
The internal and target pads are linked straight away.
The data will also travel through the other pad in order to make
pad blocking and probes non-hackish (the probe/block now really happens
on the GhostPad and not on the target).
* gst/gstpad.c: (gst_pad_set_blocked_async),
(gst_pad_link_prepare), (gst_pad_push_event):
Remove previous ghostpad cruft.
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
Remove previous ghost pad cruft.
Added more detailed debug statements.
* tests/check/gst/gstghostpad.c: (GST_START_TEST):
Fix the testsuite for refcounting changes.
The comments about who has references were correct, but the refcount
being checked wasn't the same (!?!).
2006-07-11 16:20:09 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (gisrc, "gisrc", 2); /* gsink */
|
2009-02-16 11:58:34 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (isink, "isink", 1); /* gsink */
|
gst/gstbin.c: (de)activate src pads before calling state_change on the childs.
Original commit message from CVS:
* gst/gstbin.c: (activate_pads),
(iterator_activate_fold_with_resync), (gst_bin_src_pads_activate),
(gst_bin_change_state_func):
(de)activate src pads before calling state_change on the childs.
This is to avoid the case where a src ghostpad is blocked (holding the
stream lock), which would block the deactivation of the ghostpad's
target pad.
* gst/gstghostpad.c: (gst_proxy_pad_do_query_type),
(gst_proxy_pad_do_event), (gst_proxy_pad_do_query),
(gst_proxy_pad_do_internal_link), (gst_proxy_pad_do_bufferalloc),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_set_target), (gst_proxy_pad_get_internal),
(gst_proxy_pad_dispose), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_class_init),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_no_target),
(gst_ghost_pad_new), (gst_ghost_pad_set_target):
GhostPads now create their internal GstProxyPad at creation (and not
when they're linked, as it was being done previously).
The internal and target pads are linked straight away.
The data will also travel through the other pad in order to make
pad blocking and probes non-hackish (the probe/block now really happens
on the GhostPad and not on the target).
* gst/gstpad.c: (gst_pad_set_blocked_async),
(gst_pad_link_prepare), (gst_pad_push_event):
Remove previous ghostpad cruft.
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
Remove previous ghost pad cruft.
Added more detailed debug statements.
* tests/check/gst/gstghostpad.c: (GST_START_TEST):
Fix the testsuite for refcounting changes.
The comments about who has references were correct, but the refcount
being checked wasn't the same (!?!).
2006-07-11 16:20:09 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (gisink, "gisink", 2); /* gsrc */
|
2009-02-16 11:58:34 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (isrc, "isrc", 1); /* gsrc */
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (gsink);
|
2005-10-19 11:43:42 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (isink, "isink", 1);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (gisrc, "gisrc", 1);
|
gst/gstbin.c: (de)activate src pads before calling state_change on the childs.
Original commit message from CVS:
* gst/gstbin.c: (activate_pads),
(iterator_activate_fold_with_resync), (gst_bin_src_pads_activate),
(gst_bin_change_state_func):
(de)activate src pads before calling state_change on the childs.
This is to avoid the case where a src ghostpad is blocked (holding the
stream lock), which would block the deactivation of the ghostpad's
target pad.
* gst/gstghostpad.c: (gst_proxy_pad_do_query_type),
(gst_proxy_pad_do_event), (gst_proxy_pad_do_query),
(gst_proxy_pad_do_internal_link), (gst_proxy_pad_do_bufferalloc),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_set_target), (gst_proxy_pad_get_internal),
(gst_proxy_pad_dispose), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_class_init),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_no_target),
(gst_ghost_pad_new), (gst_ghost_pad_set_target):
GhostPads now create their internal GstProxyPad at creation (and not
when they're linked, as it was being done previously).
The internal and target pads are linked straight away.
The data will also travel through the other pad in order to make
pad blocking and probes non-hackish (the probe/block now really happens
on the GhostPad and not on the target).
* gst/gstpad.c: (gst_pad_set_blocked_async),
(gst_pad_link_prepare), (gst_pad_push_event):
Remove previous ghostpad cruft.
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
Remove previous ghost pad cruft.
Added more detailed debug statements.
* tests/check/gst/gstghostpad.c: (GST_START_TEST):
Fix the testsuite for refcounting changes.
The comments about who has references were correct, but the refcount
being checked wasn't the same (!?!).
2006-07-11 16:20:09 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (fsrc, "fsrc", 1);
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (gisrc);
|
2005-10-19 11:43:42 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (fsrc, "fsrc", 1);
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (gsrc);
|
2005-10-19 11:43:42 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (isrc, "isrc", 1);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (gisink, "gisink", 1);
|
gst/gstbin.c: (de)activate src pads before calling state_change on the childs.
Original commit message from CVS:
* gst/gstbin.c: (activate_pads),
(iterator_activate_fold_with_resync), (gst_bin_src_pads_activate),
(gst_bin_change_state_func):
(de)activate src pads before calling state_change on the childs.
This is to avoid the case where a src ghostpad is blocked (holding the
stream lock), which would block the deactivation of the ghostpad's
target pad.
* gst/gstghostpad.c: (gst_proxy_pad_do_query_type),
(gst_proxy_pad_do_event), (gst_proxy_pad_do_query),
(gst_proxy_pad_do_internal_link), (gst_proxy_pad_do_bufferalloc),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_set_target), (gst_proxy_pad_get_internal),
(gst_proxy_pad_dispose), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_class_init),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_no_target),
(gst_ghost_pad_new), (gst_ghost_pad_set_target):
GhostPads now create their internal GstProxyPad at creation (and not
when they're linked, as it was being done previously).
The internal and target pads are linked straight away.
The data will also travel through the other pad in order to make
pad blocking and probes non-hackish (the probe/block now really happens
on the GhostPad and not on the target).
* gst/gstpad.c: (gst_pad_set_blocked_async),
(gst_pad_link_prepare), (gst_pad_push_event):
Remove previous ghostpad cruft.
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
Remove previous ghost pad cruft.
Added more detailed debug statements.
* tests/check/gst/gstghostpad.c: (GST_START_TEST):
Fix the testsuite for refcounting changes.
The comments about who has references were correct, but the refcount
being checked wasn't the same (!?!).
2006-07-11 16:20:09 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (fsink, "fsink", 1);
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (gisink);
|
2005-10-19 11:43:42 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (fsink, "fsink", 1);
|
check/gst/gstghostpad.c: Added test for removing an element with ghostpad from a bin.
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added test for removing an element with ghostpad from a bin.
Fixed test as current implementation does the right thing.
* gst/gstghostpad.c: (gst_proxy_pad_class_init),
(gst_proxy_pad_do_query_type), (gst_proxy_pad_do_event),
(gst_proxy_pad_do_query), (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_do_bufferalloc), (gst_proxy_pad_do_activate),
(gst_proxy_pad_do_activatepull), (gst_proxy_pad_do_activatepush),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target),
(gst_proxy_pad_get_target), (gst_proxy_pad_init),
(gst_proxy_pad_dispose), (gst_proxy_pad_finalize),
(gst_ghost_pad_class_init), (gst_ghost_pad_do_activate_push),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_set_internal), (gst_ghost_pad_dispose),
(gst_ghost_pad_new_notarget), (gst_ghost_pad_new),
(gst_ghost_pad_get_target), (gst_ghost_pad_set_target):
* gst/gstghostpad.h:
Clean up ghostpads, remove properties for internal stuff.
Make threadsafe.
Fix refcounting.
Prepare for switching targets, not all use cases work yet.
2005-07-29 19:22:28 +00:00
|
|
|
|
|
|
|
gst_object_unref (fsrc);
|
|
|
|
gst_object_unref (isrc);
|
|
|
|
gst_object_unref (isink);
|
|
|
|
gst_object_unref (fsink);
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
}
|
2005-07-11 15:10:40 +00:00
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2005-11-10 09:19:12 +00:00
|
|
|
GST_START_TEST (test_ghost_pads_bin)
|
|
|
|
{
|
|
|
|
GstBin *pipeline;
|
|
|
|
GstBin *srcbin;
|
|
|
|
GstBin *sinkbin;
|
|
|
|
GstElement *src;
|
|
|
|
GstElement *sink;
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
GstPad *srcpad, *srcghost, *target;
|
|
|
|
GstPad *sinkpad, *sinkghost;
|
2005-11-10 09:19:12 +00:00
|
|
|
|
|
|
|
pipeline = GST_BIN (gst_pipeline_new ("pipe"));
|
2006-04-29 00:33:44 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
|
2005-11-10 09:19:12 +00:00
|
|
|
|
|
|
|
srcbin = GST_BIN (gst_bin_new ("srcbin"));
|
|
|
|
gst_bin_add (pipeline, GST_ELEMENT (srcbin));
|
2007-08-16 11:04:40 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
|
2005-11-10 09:19:12 +00:00
|
|
|
|
|
|
|
sinkbin = GST_BIN (gst_bin_new ("sinkbin"));
|
|
|
|
gst_bin_add (pipeline, GST_ELEMENT (sinkbin));
|
2007-08-16 11:04:40 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
|
2005-11-10 09:19:12 +00:00
|
|
|
|
|
|
|
src = gst_element_factory_make ("fakesrc", "src");
|
|
|
|
gst_bin_add (srcbin, src);
|
2008-05-21 15:57:52 +00:00
|
|
|
srcpad = gst_element_get_static_pad (src, "src");
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
srcghost = gst_ghost_pad_new ("src", srcpad);
|
|
|
|
gst_object_unref (srcpad);
|
2005-11-10 09:19:12 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (srcbin), srcghost);
|
|
|
|
|
|
|
|
sink = gst_element_factory_make ("fakesink", "sink");
|
|
|
|
gst_bin_add (sinkbin, sink);
|
2008-05-21 15:57:52 +00:00
|
|
|
sinkpad = gst_element_get_static_pad (sink, "sink");
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
sinkghost = gst_ghost_pad_new ("sink", sinkpad);
|
|
|
|
gst_object_unref (sinkpad);
|
2005-11-10 09:19:12 +00:00
|
|
|
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);
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
target = gst_ghost_pad_get_target (GST_GHOST_PAD (srcghost));
|
|
|
|
fail_unless (GST_PAD_PEER (target) != NULL);
|
|
|
|
gst_object_unref (target);
|
|
|
|
target = gst_ghost_pad_get_target (GST_GHOST_PAD (sinkghost));
|
|
|
|
fail_unless (GST_PAD_PEER (target) != NULL);
|
|
|
|
gst_object_unref (target);
|
2006-04-29 00:33:44 +00:00
|
|
|
|
|
|
|
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
|
|
|
|
gst_object_unref (pipeline);
|
2005-11-10 09:19:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2006-06-20 08:40:40 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2012-09-12 09:52:25 +00:00
|
|
|
GMutex mutex;
|
|
|
|
GCond cond;
|
2006-06-20 08:40:40 +00:00
|
|
|
} BlockData;
|
|
|
|
|
2011-11-01 00:13:35 +00:00
|
|
|
static GstPadProbeReturn
|
2011-11-08 10:04:19 +00:00
|
|
|
block_callback (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
|
2006-06-20 08:40:40 +00:00
|
|
|
{
|
|
|
|
BlockData *block_data = (BlockData *) user_data;
|
|
|
|
|
2012-09-12 09:52:25 +00:00
|
|
|
g_mutex_lock (&block_data->mutex);
|
2006-06-20 08:40:40 +00:00
|
|
|
GST_DEBUG ("blocked\n");
|
2012-09-12 09:52:25 +00:00
|
|
|
g_cond_signal (&block_data->cond);
|
|
|
|
g_mutex_unlock (&block_data->mutex);
|
2011-05-31 17:16:09 +00:00
|
|
|
|
2011-11-01 00:13:35 +00:00
|
|
|
return GST_PAD_PROBE_OK;
|
2006-06-20 08:40:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_ghost_pads_block)
|
|
|
|
{
|
|
|
|
GstBin *pipeline;
|
|
|
|
GstBin *srcbin;
|
|
|
|
GstElement *src;
|
|
|
|
GstPad *srcpad;
|
|
|
|
GstPad *srcghost;
|
|
|
|
BlockData block_data;
|
|
|
|
|
|
|
|
pipeline = GST_BIN (gst_pipeline_new ("pipeline"));
|
|
|
|
|
|
|
|
srcbin = GST_BIN (gst_bin_new ("srcbin"));
|
|
|
|
gst_bin_add (pipeline, GST_ELEMENT (srcbin));
|
|
|
|
|
|
|
|
src = gst_element_factory_make ("fakesrc", "src");
|
|
|
|
gst_bin_add (srcbin, src);
|
2008-05-21 15:57:52 +00:00
|
|
|
srcpad = gst_element_get_static_pad (src, "src");
|
2006-06-20 08:40:40 +00:00
|
|
|
srcghost = gst_ghost_pad_new ("src", srcpad);
|
|
|
|
gst_element_add_pad (GST_ELEMENT (srcbin), srcghost);
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
|
2012-09-12 09:52:25 +00:00
|
|
|
g_mutex_init (&block_data.mutex);
|
|
|
|
g_cond_init (&block_data.cond);
|
2006-06-20 08:40:40 +00:00
|
|
|
|
2012-09-12 09:52:25 +00:00
|
|
|
g_mutex_lock (&block_data.mutex);
|
2011-11-01 00:13:35 +00:00
|
|
|
gst_pad_add_probe (srcghost, GST_PAD_PROBE_TYPE_BLOCK, block_callback,
|
2011-06-01 17:27:55 +00:00
|
|
|
&block_data, NULL);
|
2006-06-20 08:40:40 +00:00
|
|
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
|
|
|
/* and wait now */
|
2012-09-12 09:52:25 +00:00
|
|
|
g_cond_wait (&block_data.cond, &block_data.mutex);
|
|
|
|
g_mutex_unlock (&block_data.mutex);
|
2012-07-17 13:52:53 +00:00
|
|
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
|
2006-06-20 08:40:40 +00:00
|
|
|
|
2012-09-12 09:52:25 +00:00
|
|
|
g_mutex_clear (&block_data.mutex);
|
|
|
|
g_cond_clear (&block_data.cond);
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
|
|
|
|
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
|
|
|
|
gst_object_unref (pipeline);
|
2006-06-20 08:40:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST (test_ghost_pads_probes)
|
|
|
|
{
|
|
|
|
GstBin *pipeline;
|
|
|
|
GstBin *srcbin;
|
|
|
|
GstElement *src;
|
|
|
|
GstPad *srcpad;
|
|
|
|
GstPad *srcghost;
|
|
|
|
BlockData block_data;
|
|
|
|
|
|
|
|
pipeline = GST_BIN (gst_pipeline_new ("pipeline"));
|
|
|
|
|
|
|
|
srcbin = GST_BIN (gst_bin_new ("srcbin"));
|
|
|
|
gst_bin_add (pipeline, GST_ELEMENT (srcbin));
|
|
|
|
|
|
|
|
src = gst_element_factory_make ("fakesrc", "src");
|
|
|
|
gst_bin_add (srcbin, src);
|
2008-05-21 15:57:52 +00:00
|
|
|
srcpad = gst_element_get_static_pad (src, "src");
|
2006-06-20 08:40:40 +00:00
|
|
|
srcghost = gst_ghost_pad_new ("src", srcpad);
|
|
|
|
gst_element_add_pad (GST_ELEMENT (srcbin), srcghost);
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
|
2012-09-12 09:52:25 +00:00
|
|
|
g_mutex_init (&block_data.mutex);
|
|
|
|
g_cond_init (&block_data.cond);
|
2006-06-20 08:40:40 +00:00
|
|
|
|
2012-09-12 09:52:25 +00:00
|
|
|
g_mutex_lock (&block_data.mutex);
|
2011-11-01 00:13:35 +00:00
|
|
|
gst_pad_add_probe (srcghost, GST_PAD_PROBE_TYPE_BLOCK, block_callback,
|
2011-06-01 17:27:55 +00:00
|
|
|
&block_data, NULL);
|
2006-06-20 08:40:40 +00:00
|
|
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
|
|
|
/* and wait now */
|
2012-09-12 09:52:25 +00:00
|
|
|
g_cond_wait (&block_data.cond, &block_data.mutex);
|
|
|
|
g_mutex_unlock (&block_data.mutex);
|
2012-07-17 13:52:53 +00:00
|
|
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
|
2006-06-20 08:40:40 +00:00
|
|
|
|
2012-09-12 09:52:25 +00:00
|
|
|
g_mutex_clear (&block_data.mutex);
|
|
|
|
g_cond_clear (&block_data.cond);
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
|
|
|
|
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
|
|
|
|
gst_object_unref (pipeline);
|
2006-06-20 08:40:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
Refactored *_new() functions.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstghostpad.c: (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_new_no_target), (gst_ghost_pad_new),
(gst_ghost_pad_new_from_template),
(gst_ghost_pad_new_no_target_from_template):
* gst/gstghostpad.h:
Refactored *_new() functions.
Templates are now used as a g_object_new() parameter.
Use template in _do_getcaps() if we don't have a target.
Small documentation cleanups.
Added two new constructors:
gst_ghost_pad_new_from_template()
gst_ghost_pad_new_no_target_from_template()
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Added tests for new ghostpad instanciation functions.
API additions: gst_ghost_pad_new_from_template,
gst_ghost_pad_new_no_target_from_template
2006-08-31 10:59:11 +00:00
|
|
|
GST_START_TEST (test_ghost_pads_new_from_template)
|
|
|
|
{
|
|
|
|
GstPad *sinkpad, *ghostpad;
|
|
|
|
GstPadTemplate *padtempl, *ghosttempl;
|
|
|
|
GstCaps *padcaps, *ghostcaps, *newcaps;
|
|
|
|
|
|
|
|
padcaps = gst_caps_from_string ("some/caps");
|
|
|
|
fail_unless (padcaps != NULL);
|
|
|
|
ghostcaps = gst_caps_from_string ("some/caps;some/other-caps");
|
|
|
|
fail_unless (ghostcaps != NULL);
|
|
|
|
|
|
|
|
padtempl = gst_pad_template_new ("padtempl", GST_PAD_SINK,
|
2011-05-17 11:13:11 +00:00
|
|
|
GST_PAD_ALWAYS, padcaps);
|
Refactored *_new() functions.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstghostpad.c: (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_new_no_target), (gst_ghost_pad_new),
(gst_ghost_pad_new_from_template),
(gst_ghost_pad_new_no_target_from_template):
* gst/gstghostpad.h:
Refactored *_new() functions.
Templates are now used as a g_object_new() parameter.
Use template in _do_getcaps() if we don't have a target.
Small documentation cleanups.
Added two new constructors:
gst_ghost_pad_new_from_template()
gst_ghost_pad_new_no_target_from_template()
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Added tests for new ghostpad instanciation functions.
API additions: gst_ghost_pad_new_from_template,
gst_ghost_pad_new_no_target_from_template
2006-08-31 10:59:11 +00:00
|
|
|
fail_unless (padtempl != NULL);
|
|
|
|
ghosttempl = gst_pad_template_new ("ghosttempl", GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS, ghostcaps);
|
|
|
|
|
|
|
|
sinkpad = gst_pad_new_from_template (padtempl, "sinkpad");
|
|
|
|
fail_unless (sinkpad != NULL);
|
|
|
|
|
|
|
|
ghostpad = gst_ghost_pad_new_from_template ("ghostpad", sinkpad, ghosttempl);
|
|
|
|
fail_unless (ghostpad != NULL);
|
|
|
|
|
|
|
|
/* check template is properly set */
|
|
|
|
fail_unless (GST_PAD_PAD_TEMPLATE (ghostpad) == ghosttempl);
|
|
|
|
|
|
|
|
/* check ghostpad caps are from the sinkpad */
|
2011-11-15 15:46:37 +00:00
|
|
|
newcaps = gst_pad_query_caps (ghostpad, NULL);
|
Refactored *_new() functions.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstghostpad.c: (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_new_no_target), (gst_ghost_pad_new),
(gst_ghost_pad_new_from_template),
(gst_ghost_pad_new_no_target_from_template):
* gst/gstghostpad.h:
Refactored *_new() functions.
Templates are now used as a g_object_new() parameter.
Use template in _do_getcaps() if we don't have a target.
Small documentation cleanups.
Added two new constructors:
gst_ghost_pad_new_from_template()
gst_ghost_pad_new_no_target_from_template()
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Added tests for new ghostpad instanciation functions.
API additions: gst_ghost_pad_new_from_template,
gst_ghost_pad_new_no_target_from_template
2006-08-31 10:59:11 +00:00
|
|
|
fail_unless (newcaps != NULL);
|
|
|
|
fail_unless (gst_caps_is_equal (newcaps, padcaps));
|
2006-10-02 16:46:16 +00:00
|
|
|
gst_caps_unref (newcaps);
|
|
|
|
gst_caps_unref (padcaps);
|
2011-05-17 11:13:11 +00:00
|
|
|
gst_caps_unref (ghostcaps);
|
2008-06-24 07:49:36 +00:00
|
|
|
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
gst_object_unref (ghostpad);
|
|
|
|
|
|
|
|
gst_object_unref (padtempl);
|
|
|
|
gst_object_unref (ghosttempl);
|
Refactored *_new() functions.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstghostpad.c: (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_new_no_target), (gst_ghost_pad_new),
(gst_ghost_pad_new_from_template),
(gst_ghost_pad_new_no_target_from_template):
* gst/gstghostpad.h:
Refactored *_new() functions.
Templates are now used as a g_object_new() parameter.
Use template in _do_getcaps() if we don't have a target.
Small documentation cleanups.
Added two new constructors:
gst_ghost_pad_new_from_template()
gst_ghost_pad_new_no_target_from_template()
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Added tests for new ghostpad instanciation functions.
API additions: gst_ghost_pad_new_from_template,
gst_ghost_pad_new_no_target_from_template
2006-08-31 10:59:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST (test_ghost_pads_new_no_target_from_template)
|
|
|
|
{
|
|
|
|
GstPad *sinkpad, *ghostpad;
|
|
|
|
GstPadTemplate *padtempl, *ghosttempl;
|
|
|
|
GstCaps *padcaps, *ghostcaps, *newcaps;
|
|
|
|
|
|
|
|
padcaps = gst_caps_from_string ("some/caps");
|
|
|
|
fail_unless (padcaps != NULL);
|
|
|
|
ghostcaps = gst_caps_from_string ("some/caps;some/other-caps");
|
|
|
|
fail_unless (ghostcaps != NULL);
|
|
|
|
|
|
|
|
padtempl = gst_pad_template_new ("padtempl", GST_PAD_SINK,
|
2011-05-17 11:13:11 +00:00
|
|
|
GST_PAD_ALWAYS, padcaps);
|
Refactored *_new() functions.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstghostpad.c: (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_new_no_target), (gst_ghost_pad_new),
(gst_ghost_pad_new_from_template),
(gst_ghost_pad_new_no_target_from_template):
* gst/gstghostpad.h:
Refactored *_new() functions.
Templates are now used as a g_object_new() parameter.
Use template in _do_getcaps() if we don't have a target.
Small documentation cleanups.
Added two new constructors:
gst_ghost_pad_new_from_template()
gst_ghost_pad_new_no_target_from_template()
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Added tests for new ghostpad instanciation functions.
API additions: gst_ghost_pad_new_from_template,
gst_ghost_pad_new_no_target_from_template
2006-08-31 10:59:11 +00:00
|
|
|
fail_unless (padtempl != NULL);
|
|
|
|
ghosttempl = gst_pad_template_new ("ghosttempl", GST_PAD_SINK,
|
2011-05-17 11:13:11 +00:00
|
|
|
GST_PAD_ALWAYS, ghostcaps);
|
2008-08-30 11:55:59 +00:00
|
|
|
|
Refactored *_new() functions.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstghostpad.c: (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_new_no_target), (gst_ghost_pad_new),
(gst_ghost_pad_new_from_template),
(gst_ghost_pad_new_no_target_from_template):
* gst/gstghostpad.h:
Refactored *_new() functions.
Templates are now used as a g_object_new() parameter.
Use template in _do_getcaps() if we don't have a target.
Small documentation cleanups.
Added two new constructors:
gst_ghost_pad_new_from_template()
gst_ghost_pad_new_no_target_from_template()
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Added tests for new ghostpad instanciation functions.
API additions: gst_ghost_pad_new_from_template,
gst_ghost_pad_new_no_target_from_template
2006-08-31 10:59:11 +00:00
|
|
|
sinkpad = gst_pad_new_from_template (padtempl, "sinkpad");
|
|
|
|
fail_unless (sinkpad != NULL);
|
|
|
|
|
|
|
|
ghostpad = gst_ghost_pad_new_no_target_from_template ("ghostpad", ghosttempl);
|
|
|
|
fail_unless (ghostpad != NULL);
|
|
|
|
|
|
|
|
/* check template is properly set */
|
|
|
|
fail_unless (GST_PAD_PAD_TEMPLATE (ghostpad) == ghosttempl);
|
|
|
|
|
|
|
|
/* check ghostpad caps are from the ghostpad template */
|
2011-11-15 15:46:37 +00:00
|
|
|
newcaps = gst_pad_query_caps (ghostpad, NULL);
|
Refactored *_new() functions.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstghostpad.c: (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_new_no_target), (gst_ghost_pad_new),
(gst_ghost_pad_new_from_template),
(gst_ghost_pad_new_no_target_from_template):
* gst/gstghostpad.h:
Refactored *_new() functions.
Templates are now used as a g_object_new() parameter.
Use template in _do_getcaps() if we don't have a target.
Small documentation cleanups.
Added two new constructors:
gst_ghost_pad_new_from_template()
gst_ghost_pad_new_no_target_from_template()
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Added tests for new ghostpad instanciation functions.
API additions: gst_ghost_pad_new_from_template,
gst_ghost_pad_new_no_target_from_template
2006-08-31 10:59:11 +00:00
|
|
|
fail_unless (newcaps != NULL);
|
|
|
|
fail_unless (gst_caps_is_equal (newcaps, ghostcaps));
|
|
|
|
gst_caps_unref (newcaps);
|
|
|
|
|
|
|
|
fail_unless (gst_ghost_pad_set_target ((GstGhostPad *) ghostpad, sinkpad));
|
|
|
|
|
|
|
|
/* check ghostpad caps are now from the target pad */
|
2011-11-15 15:46:37 +00:00
|
|
|
newcaps = gst_pad_query_caps (ghostpad, NULL);
|
Refactored *_new() functions.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstghostpad.c: (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_new_no_target), (gst_ghost_pad_new),
(gst_ghost_pad_new_from_template),
(gst_ghost_pad_new_no_target_from_template):
* gst/gstghostpad.h:
Refactored *_new() functions.
Templates are now used as a g_object_new() parameter.
Use template in _do_getcaps() if we don't have a target.
Small documentation cleanups.
Added two new constructors:
gst_ghost_pad_new_from_template()
gst_ghost_pad_new_no_target_from_template()
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Added tests for new ghostpad instanciation functions.
API additions: gst_ghost_pad_new_from_template,
gst_ghost_pad_new_no_target_from_template
2006-08-31 10:59:11 +00:00
|
|
|
fail_unless (newcaps != NULL);
|
|
|
|
fail_unless (gst_caps_is_equal (newcaps, padcaps));
|
|
|
|
gst_caps_unref (newcaps);
|
|
|
|
|
2008-06-24 07:49:36 +00:00
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
gst_object_unref (ghostpad);
|
|
|
|
|
|
|
|
gst_object_unref (padtempl);
|
|
|
|
gst_object_unref (ghosttempl);
|
|
|
|
|
|
|
|
gst_caps_unref (padcaps);
|
|
|
|
gst_caps_unref (ghostcaps);
|
Refactored *_new() functions.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstghostpad.c: (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_new_no_target), (gst_ghost_pad_new),
(gst_ghost_pad_new_from_template),
(gst_ghost_pad_new_no_target_from_template):
* gst/gstghostpad.h:
Refactored *_new() functions.
Templates are now used as a g_object_new() parameter.
Use template in _do_getcaps() if we don't have a target.
Small documentation cleanups.
Added two new constructors:
gst_ghost_pad_new_from_template()
gst_ghost_pad_new_no_target_from_template()
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Added tests for new ghostpad instanciation functions.
API additions: gst_ghost_pad_new_from_template,
gst_ghost_pad_new_no_target_from_template
2006-08-31 10:59:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2008-12-17 16:16:45 +00:00
|
|
|
static void
|
|
|
|
ghost_notify_caps (GObject * object, GParamSpec * pspec, gpointer * user_data)
|
|
|
|
{
|
2008-12-19 11:24:36 +00:00
|
|
|
GST_DEBUG ("caps notify called");
|
2008-12-17 16:16:45 +00:00
|
|
|
(*(gint *) user_data)++;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_ghost_pads_forward_setcaps)
|
|
|
|
{
|
|
|
|
GstCaps *templ_caps, *caps1, *caps2;
|
|
|
|
GstPadTemplate *src_template, *sink_template;
|
|
|
|
GstPad *src, *ghost, *sink;
|
|
|
|
gint notify_counter = 0;
|
|
|
|
|
|
|
|
templ_caps = gst_caps_from_string ("meh; muh");
|
|
|
|
src_template = gst_pad_template_new ("src", GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS, templ_caps);
|
2011-05-17 11:13:11 +00:00
|
|
|
gst_caps_unref (templ_caps);
|
2009-04-08 14:49:18 +00:00
|
|
|
|
|
|
|
templ_caps = gst_caps_from_string ("muh; meh");
|
2008-12-17 16:16:45 +00:00
|
|
|
sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS, templ_caps);
|
2011-05-17 11:13:11 +00:00
|
|
|
gst_caps_unref (templ_caps);
|
2008-12-17 16:16:45 +00:00
|
|
|
|
|
|
|
src = gst_pad_new_from_template (src_template, "src");
|
|
|
|
sink = gst_pad_new_from_template (sink_template, "sink");
|
|
|
|
|
2008-12-19 11:24:36 +00:00
|
|
|
/* ghost source pad, setting caps on the source influences the caps of the
|
|
|
|
* ghostpad. */
|
2008-12-17 16:16:45 +00:00
|
|
|
ghost = gst_ghost_pad_new ("ghostsrc", src);
|
|
|
|
g_signal_connect (ghost, "notify::caps",
|
|
|
|
G_CALLBACK (ghost_notify_caps), ¬ify_counter);
|
|
|
|
fail_unless (gst_pad_link (ghost, sink) == GST_PAD_LINK_OK);
|
|
|
|
|
2011-06-06 08:27:57 +00:00
|
|
|
/* Activate pads for caps forwarding/setting to work */
|
|
|
|
gst_pad_set_active (src, TRUE);
|
|
|
|
gst_pad_set_active (ghost, TRUE);
|
|
|
|
|
2008-12-17 16:16:45 +00:00
|
|
|
caps1 = gst_caps_from_string ("meh");
|
|
|
|
fail_unless (gst_pad_set_caps (src, caps1));
|
2011-05-09 14:21:28 +00:00
|
|
|
caps2 = gst_pad_get_current_caps (ghost);
|
2008-12-17 16:16:45 +00:00
|
|
|
fail_unless (gst_caps_is_equal (caps1, caps2));
|
|
|
|
fail_unless_equals_int (notify_counter, 1);
|
|
|
|
|
|
|
|
gst_object_unref (ghost);
|
|
|
|
gst_caps_unref (caps1);
|
2011-10-11 11:54:45 +00:00
|
|
|
gst_caps_unref (caps2);
|
2008-12-17 16:16:45 +00:00
|
|
|
|
2008-12-19 11:24:36 +00:00
|
|
|
/* 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), ¬ify_counter);
|
|
|
|
fail_unless (gst_pad_link (ghost, sink) == GST_PAD_LINK_OK);
|
|
|
|
|
2011-05-16 17:05:23 +00:00
|
|
|
gst_pad_set_active (ghost, TRUE);
|
|
|
|
gst_pad_set_active (sink, TRUE);
|
|
|
|
|
2008-12-19 11:24:36 +00:00
|
|
|
caps1 = gst_caps_from_string ("meh");
|
|
|
|
fail_unless (gst_pad_set_caps (ghost, caps1));
|
2011-05-16 17:05:23 +00:00
|
|
|
#if 0
|
2011-05-09 14:21:28 +00:00
|
|
|
caps2 = gst_pad_get_current_caps (src);
|
2008-12-19 15:11:06 +00:00
|
|
|
fail_unless (caps2 == NULL);
|
2011-05-16 17:05:23 +00:00
|
|
|
#endif
|
2008-12-19 11:24:36 +00:00
|
|
|
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. */
|
2008-12-17 16:16:45 +00:00
|
|
|
notify_counter = 0;
|
|
|
|
ghost = gst_ghost_pad_new ("ghostsink", sink);
|
|
|
|
g_signal_connect (ghost, "notify::caps",
|
|
|
|
G_CALLBACK (ghost_notify_caps), ¬ify_counter);
|
|
|
|
fail_unless (gst_pad_link (src, ghost) == GST_PAD_LINK_OK);
|
|
|
|
|
2011-05-16 17:05:23 +00:00
|
|
|
gst_pad_set_active (src, TRUE);
|
|
|
|
gst_pad_set_active (ghost, TRUE);
|
|
|
|
|
2008-12-17 16:16:45 +00:00
|
|
|
caps1 = gst_caps_from_string ("muh");
|
|
|
|
fail_unless (gst_pad_set_caps (ghost, caps1));
|
2011-05-09 14:21:28 +00:00
|
|
|
caps2 = gst_pad_get_current_caps (sink);
|
2008-12-17 16:16:45 +00:00
|
|
|
fail_unless (gst_caps_is_equal (caps1, caps2));
|
|
|
|
fail_unless_equals_int (notify_counter, 1);
|
|
|
|
|
2008-12-19 11:24:36 +00:00
|
|
|
gst_object_unref (ghost);
|
|
|
|
gst_caps_unref (caps1);
|
2011-10-11 11:54:45 +00:00
|
|
|
gst_caps_unref (caps2);
|
2008-12-19 11:24:36 +00:00
|
|
|
|
2011-05-17 16:23:22 +00:00
|
|
|
/* clear caps on pads */
|
|
|
|
gst_pad_set_active (src, FALSE);
|
|
|
|
gst_pad_set_active (src, TRUE);
|
|
|
|
gst_pad_set_active (sink, FALSE);
|
|
|
|
gst_pad_set_active (sink, TRUE);
|
|
|
|
|
2008-12-19 11:24:36 +00:00
|
|
|
/* sink pad 2, setting caps just on the target pad should not influence the caps
|
|
|
|
* on the ghostpad. */
|
|
|
|
notify_counter = 0;
|
|
|
|
ghost = gst_ghost_pad_new ("ghostsink", sink);
|
2011-05-17 16:23:22 +00:00
|
|
|
fail_unless (gst_pad_get_current_caps (ghost) == NULL);
|
2008-12-19 11:24:36 +00:00
|
|
|
g_signal_connect (ghost, "notify::caps",
|
|
|
|
G_CALLBACK (ghost_notify_caps), ¬ify_counter);
|
|
|
|
fail_unless (gst_pad_link (src, ghost) == GST_PAD_LINK_OK);
|
|
|
|
|
2011-05-16 17:05:23 +00:00
|
|
|
gst_pad_set_active (ghost, TRUE);
|
|
|
|
|
2008-12-19 11:24:36 +00:00
|
|
|
caps1 = gst_caps_from_string ("muh");
|
|
|
|
fail_unless (gst_pad_set_caps (sink, caps1));
|
2011-05-09 14:21:28 +00:00
|
|
|
caps2 = gst_pad_get_current_caps (ghost);
|
2008-12-19 11:24:36 +00:00
|
|
|
fail_unless (caps2 == NULL);
|
|
|
|
fail_unless_equals_int (notify_counter, 0);
|
|
|
|
|
|
|
|
gst_object_unref (ghost);
|
|
|
|
gst_caps_unref (caps1);
|
|
|
|
|
2008-12-17 16:16:45 +00:00
|
|
|
gst_object_unref (src);
|
|
|
|
gst_object_unref (sink);
|
|
|
|
gst_object_unref (src_template);
|
|
|
|
gst_object_unref (sink_template);
|
|
|
|
}
|
2009-02-16 11:58:34 +00:00
|
|
|
|
2009-01-21 11:21:49 +00:00
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
static gint linked_count1;
|
|
|
|
static gint unlinked_count1;
|
|
|
|
static gint linked_count2;
|
|
|
|
static gint unlinked_count2;
|
|
|
|
|
|
|
|
static GstPadLinkReturn
|
2012-09-17 11:09:58 +00:00
|
|
|
pad_linked1 (GstPad * pad, GstObject * parent, GstPad * peer)
|
2009-01-21 11:21:49 +00:00
|
|
|
{
|
|
|
|
linked_count1++;
|
|
|
|
|
|
|
|
return GST_PAD_LINK_OK;
|
|
|
|
}
|
2009-02-16 11:58:34 +00:00
|
|
|
|
2009-01-21 11:21:49 +00:00
|
|
|
static void
|
2012-09-17 11:09:58 +00:00
|
|
|
pad_unlinked1 (GstPad * pad, GstObject * parent)
|
2009-01-21 11:21:49 +00:00
|
|
|
{
|
|
|
|
unlinked_count1++;
|
|
|
|
}
|
2009-02-16 11:58:34 +00:00
|
|
|
|
2009-01-21 11:21:49 +00:00
|
|
|
static GstPadLinkReturn
|
2012-09-17 11:09:58 +00:00
|
|
|
pad_linked2 (GstPad * pad, GstObject * parent, GstPad * peer)
|
2009-01-21 11:21:49 +00:00
|
|
|
{
|
|
|
|
linked_count2++;
|
|
|
|
|
|
|
|
return GST_PAD_LINK_OK;
|
|
|
|
}
|
2009-02-16 11:58:34 +00:00
|
|
|
|
2009-01-21 11:21:49 +00:00
|
|
|
static void
|
2012-09-17 11:09:58 +00:00
|
|
|
pad_unlinked2 (GstPad * pad, GstObject * parent)
|
2009-01-21 11:21:49 +00:00
|
|
|
{
|
|
|
|
unlinked_count2++;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_ghost_pads_sink_link_unlink)
|
|
|
|
{
|
|
|
|
GstCaps *padcaps;
|
|
|
|
GstPad *srcpad, *sinkpad, *ghostpad;
|
|
|
|
GstPadTemplate *srctempl, *sinktempl;
|
|
|
|
GstPadLinkReturn ret;
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
padcaps = gst_caps_from_string ("some/caps");
|
|
|
|
fail_unless (padcaps != NULL);
|
|
|
|
srctempl = gst_pad_template_new ("srctempl", GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS, padcaps);
|
2011-05-17 11:13:11 +00:00
|
|
|
gst_caps_unref (padcaps);
|
2009-04-08 14:49:18 +00:00
|
|
|
|
|
|
|
padcaps = gst_caps_from_string ("some/caps");
|
|
|
|
fail_unless (padcaps != NULL);
|
2009-01-21 11:21:49 +00:00
|
|
|
sinktempl = gst_pad_template_new ("sinktempl", GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS, padcaps);
|
2011-05-17 11:13:11 +00:00
|
|
|
gst_caps_unref (padcaps);
|
2009-01-21 11:21:49 +00:00
|
|
|
|
|
|
|
srcpad = gst_pad_new_from_template (srctempl, "src");
|
|
|
|
fail_unless (srcpad != NULL);
|
|
|
|
sinkpad = gst_pad_new_from_template (sinktempl, "sink");
|
|
|
|
fail_unless (sinkpad != NULL);
|
2008-12-17 16:16:45 +00:00
|
|
|
|
2009-01-21 11:21:49 +00:00
|
|
|
/* set up link/unlink functions for the pad */
|
|
|
|
linked_count1 = unlinked_count1 = 0;
|
|
|
|
gst_pad_set_link_function (sinkpad, pad_linked1);
|
|
|
|
gst_pad_set_unlink_function (sinkpad, pad_unlinked1);
|
|
|
|
linked_count2 = unlinked_count2 = 0;
|
|
|
|
gst_pad_set_link_function (srcpad, pad_linked2);
|
|
|
|
gst_pad_set_unlink_function (srcpad, pad_unlinked2);
|
|
|
|
|
|
|
|
/* this should trigger a link from the internal pad to the sinkpad */
|
|
|
|
ghostpad = gst_ghost_pad_new ("ghostpad", sinkpad);
|
|
|
|
fail_unless (ghostpad != NULL);
|
|
|
|
fail_unless (linked_count1 == 1);
|
|
|
|
fail_unless (unlinked_count1 == 0);
|
|
|
|
fail_unless (linked_count2 == 0);
|
|
|
|
fail_unless (unlinked_count2 == 0);
|
|
|
|
|
|
|
|
/* this should not trigger anything because we are not directly
|
|
|
|
* linking/unlinking the sink pad. */
|
|
|
|
ret = gst_pad_link (srcpad, ghostpad);
|
|
|
|
fail_unless (ret == GST_PAD_LINK_OK);
|
|
|
|
fail_unless (linked_count1 == 1);
|
|
|
|
fail_unless (unlinked_count1 == 0);
|
|
|
|
fail_unless (linked_count2 == 1);
|
|
|
|
fail_unless (unlinked_count2 == 0);
|
|
|
|
|
|
|
|
res = gst_pad_unlink (srcpad, ghostpad);
|
|
|
|
fail_unless (res == TRUE);
|
|
|
|
fail_unless (linked_count1 == 1);
|
|
|
|
fail_unless (unlinked_count1 == 0);
|
|
|
|
fail_unless (linked_count2 == 1);
|
|
|
|
fail_unless (unlinked_count2 == 1);
|
|
|
|
|
|
|
|
/* this should trigger the unlink */
|
|
|
|
res = gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (ghostpad), NULL);
|
|
|
|
fail_unless (res == TRUE);
|
|
|
|
fail_unless (linked_count1 == 1);
|
|
|
|
fail_unless (unlinked_count1 == 1);
|
|
|
|
fail_unless (linked_count2 == 1);
|
|
|
|
fail_unless (unlinked_count2 == 1);
|
|
|
|
|
|
|
|
gst_object_unref (ghostpad);
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
gst_object_unref (srctempl);
|
|
|
|
gst_object_unref (sinktempl);
|
|
|
|
}
|
2009-02-16 11:58:34 +00:00
|
|
|
|
2009-01-21 11:21:49 +00:00
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST (test_ghost_pads_src_link_unlink)
|
|
|
|
{
|
|
|
|
GstCaps *padcaps;
|
|
|
|
GstPad *srcpad, *sinkpad, *ghostpad, *dummy;
|
|
|
|
GstPadTemplate *srctempl, *sinktempl;
|
|
|
|
GstPadLinkReturn ret;
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
padcaps = gst_caps_from_string ("some/caps");
|
|
|
|
fail_unless (padcaps != NULL);
|
|
|
|
srctempl = gst_pad_template_new ("srctempl", GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS, padcaps);
|
2011-05-17 11:13:11 +00:00
|
|
|
gst_caps_unref (padcaps);
|
2009-04-08 14:49:18 +00:00
|
|
|
|
|
|
|
padcaps = gst_caps_from_string ("some/caps");
|
|
|
|
fail_unless (padcaps != NULL);
|
2009-01-21 11:21:49 +00:00
|
|
|
sinktempl = gst_pad_template_new ("sinktempl", GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS, padcaps);
|
2011-05-17 11:13:11 +00:00
|
|
|
gst_caps_unref (padcaps);
|
2009-01-21 11:21:49 +00:00
|
|
|
|
|
|
|
srcpad = gst_pad_new_from_template (srctempl, "src");
|
|
|
|
fail_unless (srcpad != NULL);
|
|
|
|
sinkpad = gst_pad_new_from_template (sinktempl, "sink");
|
|
|
|
fail_unless (sinkpad != NULL);
|
|
|
|
|
|
|
|
/* set up link/unlink functions for the pad */
|
|
|
|
linked_count1 = unlinked_count1 = 0;
|
|
|
|
gst_pad_set_link_function (srcpad, pad_linked1);
|
|
|
|
gst_pad_set_unlink_function (srcpad, pad_unlinked1);
|
|
|
|
linked_count2 = unlinked_count2 = 0;
|
|
|
|
gst_pad_set_link_function (sinkpad, pad_linked2);
|
|
|
|
gst_pad_set_unlink_function (sinkpad, pad_unlinked2);
|
|
|
|
|
|
|
|
/* this should trigger a link from the internal pad to the srcpad */
|
|
|
|
ghostpad = gst_ghost_pad_new ("ghostpad", srcpad);
|
|
|
|
fail_unless (ghostpad != NULL);
|
|
|
|
fail_unless (linked_count1 == 1);
|
|
|
|
fail_unless (unlinked_count1 == 0);
|
|
|
|
fail_unless (linked_count2 == 0);
|
|
|
|
fail_unless (unlinked_count2 == 0);
|
|
|
|
|
|
|
|
/* this should fail with a critial */
|
|
|
|
ASSERT_CRITICAL (dummy = gst_ghost_pad_new ("ghostpad", srcpad));
|
|
|
|
fail_unless (dummy == NULL);
|
|
|
|
fail_unless (linked_count1 == 1);
|
|
|
|
fail_unless (unlinked_count1 == 0);
|
|
|
|
fail_unless (linked_count2 == 0);
|
|
|
|
fail_unless (unlinked_count2 == 0);
|
|
|
|
|
|
|
|
/* this should not trigger anything because we are not directly
|
|
|
|
* linking/unlinking the src pad. */
|
|
|
|
ret = gst_pad_link (ghostpad, sinkpad);
|
|
|
|
fail_unless (ret == GST_PAD_LINK_OK);
|
|
|
|
fail_unless (linked_count1 == 1);
|
|
|
|
fail_unless (unlinked_count1 == 0);
|
|
|
|
fail_unless (linked_count2 == 1);
|
|
|
|
fail_unless (unlinked_count2 == 0);
|
|
|
|
|
|
|
|
/* this link should fail because we are already linked. Let's make sure the
|
|
|
|
* link functions are not called */
|
|
|
|
ret = gst_pad_link (ghostpad, sinkpad);
|
|
|
|
fail_unless (ret == GST_PAD_LINK_WAS_LINKED);
|
|
|
|
fail_unless (linked_count1 == 1);
|
|
|
|
fail_unless (unlinked_count1 == 0);
|
|
|
|
fail_unless (linked_count2 == 1);
|
|
|
|
fail_unless (unlinked_count2 == 0);
|
|
|
|
|
|
|
|
res = gst_pad_unlink (ghostpad, sinkpad);
|
|
|
|
fail_unless (res == TRUE);
|
|
|
|
fail_unless (linked_count1 == 1);
|
|
|
|
fail_unless (unlinked_count1 == 0);
|
|
|
|
fail_unless (linked_count2 == 1);
|
|
|
|
fail_unless (unlinked_count2 == 1);
|
|
|
|
|
|
|
|
res = gst_pad_unlink (ghostpad, sinkpad);
|
|
|
|
fail_unless (res == FALSE);
|
|
|
|
fail_unless (linked_count1 == 1);
|
|
|
|
fail_unless (unlinked_count1 == 0);
|
|
|
|
fail_unless (linked_count2 == 1);
|
|
|
|
fail_unless (unlinked_count2 == 1);
|
|
|
|
|
|
|
|
/* this should trigger the unlink function */
|
|
|
|
res = gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (ghostpad), NULL);
|
|
|
|
fail_unless (res == TRUE);
|
|
|
|
fail_unless (linked_count1 == 1);
|
|
|
|
fail_unless (unlinked_count1 == 1);
|
|
|
|
fail_unless (linked_count2 == 1);
|
|
|
|
fail_unless (unlinked_count2 == 1);
|
|
|
|
|
|
|
|
/* and this the link function again */
|
|
|
|
res = gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (ghostpad), srcpad);
|
|
|
|
fail_unless (res == TRUE);
|
|
|
|
fail_unless (linked_count1 == 2);
|
|
|
|
fail_unless (unlinked_count1 == 1);
|
|
|
|
fail_unless (linked_count2 == 1);
|
|
|
|
fail_unless (unlinked_count2 == 1);
|
|
|
|
|
|
|
|
gst_object_unref (ghostpad);
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
gst_object_unref (srctempl);
|
|
|
|
gst_object_unref (sinktempl);
|
|
|
|
}
|
2009-02-16 11:58:34 +00:00
|
|
|
|
2008-12-17 16:16:45 +00:00
|
|
|
GST_END_TEST;
|
|
|
|
|
2009-09-26 20:43:37 +00:00
|
|
|
GST_START_TEST (test_ghost_pads_change_when_linked)
|
|
|
|
{
|
|
|
|
GstElement *b1, *b2, *src, *fmt, *sink1, *sink2;
|
|
|
|
GstPad *sinkpad, *ghostpad;
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
b1 = gst_element_factory_make ("pipeline", NULL);
|
|
|
|
b2 = gst_element_factory_make ("bin", NULL);
|
|
|
|
src = gst_element_factory_make ("fakesrc", NULL);
|
|
|
|
fmt = gst_element_factory_make ("capsfilter", NULL);
|
|
|
|
sink1 = gst_element_factory_make ("fakesink", NULL);
|
|
|
|
sink2 = gst_element_factory_make ("fakesink", NULL);
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (b2), sink1);
|
|
|
|
gst_bin_add (GST_BIN (b2), sink2);
|
|
|
|
gst_bin_add (GST_BIN (b1), src);
|
|
|
|
gst_bin_add (GST_BIN (b1), fmt);
|
|
|
|
gst_bin_add (GST_BIN (b1), b2);
|
|
|
|
|
2012-03-01 10:06:49 +00:00
|
|
|
caps = gst_caps_from_string ("audio/x-raw, format=S16LE, channels=1");
|
2009-09-26 20:43:37 +00:00
|
|
|
g_object_set (fmt, "caps", caps, NULL);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
/* create the ghostpad as a sink-pad for bin 2 */
|
|
|
|
ghostpad = gst_ghost_pad_new_no_target ("sink", GST_PAD_SINK);
|
|
|
|
gst_element_add_pad (b2, ghostpad);
|
|
|
|
|
|
|
|
sinkpad = gst_element_get_static_pad (sink1, "sink");
|
|
|
|
fail_unless (gst_ghost_pad_set_target ((GstGhostPad *) ghostpad, sinkpad));
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
|
|
|
|
fail_unless (gst_element_link_many (src, fmt, b2, NULL));
|
|
|
|
|
|
|
|
/* set different target after ghostpad is linked */
|
|
|
|
sinkpad = gst_element_get_static_pad (sink2, "sink");
|
|
|
|
fail_unless (gst_ghost_pad_set_target ((GstGhostPad *) ghostpad, sinkpad));
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
|
|
|
|
/* clean up */
|
|
|
|
gst_object_unref (b1);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2011-10-25 21:26:50 +00:00
|
|
|
/* test that setting a ghostpad proxy pad as ghostpad target automatically set
|
|
|
|
* both ghostpad targets.
|
|
|
|
*
|
|
|
|
* fakesrc ! ( ) ! fakesink
|
|
|
|
*/
|
|
|
|
|
|
|
|
GST_START_TEST (test_ghost_pads_internal_link)
|
|
|
|
{
|
|
|
|
GstElement *pipeline, *src, *bin, *sink;
|
|
|
|
GstPad *sinkpad, *srcpad, *target;
|
|
|
|
GstProxyPad *proxypad;
|
|
|
|
|
|
|
|
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
|
|
bin = gst_element_factory_make ("bin", NULL);
|
|
|
|
src = gst_element_factory_make ("fakesrc", NULL);
|
|
|
|
sink = gst_element_factory_make ("fakesink", NULL);
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), bin);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), sink);
|
|
|
|
|
|
|
|
/* create the sink ghostpad */
|
|
|
|
sinkpad = gst_ghost_pad_new_no_target ("sink", GST_PAD_SINK);
|
|
|
|
proxypad = gst_proxy_pad_get_internal (GST_PROXY_PAD (sinkpad));
|
|
|
|
gst_element_add_pad (bin, sinkpad);
|
|
|
|
|
|
|
|
/* create the src ghostpad and link it to sink proxypad */
|
|
|
|
srcpad = gst_ghost_pad_new ("src", GST_PAD (proxypad));
|
|
|
|
gst_object_unref (proxypad);
|
|
|
|
gst_element_add_pad (bin, srcpad);
|
|
|
|
|
|
|
|
fail_unless (gst_element_link_many (src, bin, sink, NULL));
|
|
|
|
|
|
|
|
/* Check that both targets are set, and point to each other */
|
|
|
|
target = gst_ghost_pad_get_target (GST_GHOST_PAD (sinkpad));
|
|
|
|
fail_if (target == NULL);
|
|
|
|
proxypad = gst_proxy_pad_get_internal (GST_PROXY_PAD (srcpad));
|
|
|
|
fail_unless (target == GST_PAD (proxypad));
|
|
|
|
gst_object_unref (target);
|
|
|
|
gst_object_unref (proxypad);
|
|
|
|
|
|
|
|
target = gst_ghost_pad_get_target (GST_GHOST_PAD (srcpad));
|
|
|
|
fail_if (target == NULL);
|
|
|
|
proxypad = gst_proxy_pad_get_internal (GST_PROXY_PAD (sinkpad));
|
|
|
|
fail_unless (target == GST_PAD (proxypad));
|
|
|
|
gst_object_unref (target);
|
|
|
|
gst_object_unref (proxypad);
|
|
|
|
|
|
|
|
/* clean up */
|
|
|
|
gst_object_unref (pipeline);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
2009-09-26 20:43:37 +00:00
|
|
|
|
2012-09-25 18:44:54 +00:00
|
|
|
/* Test that remove a ghostpad that has something flowing through it does not
|
|
|
|
* crash the program
|
|
|
|
*/
|
|
|
|
|
|
|
|
GstElement *bin;
|
|
|
|
GstPad *ghostsink;
|
|
|
|
GstPad *ghostsrc;
|
|
|
|
|
|
|
|
static GstPadProbeReturn
|
|
|
|
remove_ghostpad_probe_cb (GstPad * pad, GstPadProbeInfo * info, gpointer data)
|
|
|
|
{
|
|
|
|
gst_pad_set_active (ghostsrc, FALSE);
|
|
|
|
gst_pad_set_active (ghostsink, FALSE);
|
|
|
|
gst_element_remove_pad (bin, ghostsrc);
|
|
|
|
gst_element_remove_pad (bin, ghostsink);
|
|
|
|
|
|
|
|
return GST_PAD_PROBE_DROP;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_ghost_pads_remove_while_playing)
|
|
|
|
{
|
|
|
|
GstPad *sinkpad;
|
|
|
|
GstPad *srcpad;
|
2013-05-09 11:32:07 +00:00
|
|
|
GstSegment segment;
|
2012-09-25 18:44:54 +00:00
|
|
|
|
|
|
|
bin = gst_bin_new (NULL);
|
|
|
|
gst_element_set_state (bin, GST_STATE_PLAYING);
|
|
|
|
|
|
|
|
ghostsrc = gst_ghost_pad_new_no_target ("ghostsrc", GST_PAD_SRC);
|
|
|
|
sinkpad = GST_PAD (gst_proxy_pad_get_internal (GST_PROXY_PAD (ghostsrc)));
|
|
|
|
ghostsink = gst_ghost_pad_new ("ghostsink", sinkpad);
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
gst_pad_set_active (ghostsrc, TRUE);
|
|
|
|
gst_pad_set_active (ghostsink, TRUE);
|
|
|
|
gst_element_add_pad (bin, ghostsrc);
|
|
|
|
gst_element_add_pad (bin, ghostsink);
|
|
|
|
|
|
|
|
srcpad = gst_pad_new ("srcpad", GST_PAD_SRC);
|
|
|
|
gst_pad_set_active (srcpad, TRUE);
|
|
|
|
gst_pad_link (srcpad, ghostsink);
|
|
|
|
|
2013-05-09 11:32:07 +00:00
|
|
|
gst_segment_init (&segment, GST_FORMAT_BYTES);
|
|
|
|
fail_unless (gst_pad_push_event (srcpad,
|
|
|
|
gst_event_new_stream_start ("test")) == TRUE);
|
|
|
|
fail_unless (gst_pad_push_event (srcpad,
|
|
|
|
gst_event_new_segment (&segment)) == TRUE);
|
|
|
|
|
2012-09-25 18:44:54 +00:00
|
|
|
gst_pad_add_probe (ghostsrc, GST_PAD_PROBE_TYPE_BUFFER,
|
|
|
|
remove_ghostpad_probe_cb, NULL, NULL);
|
|
|
|
|
|
|
|
g_assert (gst_pad_push (srcpad, gst_buffer_new ()) == GST_FLOW_OK);
|
|
|
|
|
|
|
|
gst_pad_set_active (srcpad, FALSE);
|
|
|
|
gst_element_set_state (bin, GST_STATE_NULL);
|
|
|
|
gst_object_unref (bin);
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2016-02-17 10:02:34 +00:00
|
|
|
|
|
|
|
GST_START_TEST (test_activate_src)
|
|
|
|
{
|
|
|
|
GstHarness *h;
|
|
|
|
GstElement *b;
|
|
|
|
GstElement *src;
|
|
|
|
GstPad *srcpad;
|
|
|
|
|
|
|
|
b = gst_bin_new (NULL);
|
|
|
|
src = gst_element_factory_make ("fakesrc", NULL);
|
|
|
|
g_object_set (src, "sync", TRUE, NULL);
|
|
|
|
gst_bin_add (GST_BIN (b), src);
|
|
|
|
|
|
|
|
srcpad = gst_element_get_static_pad (src, "src");
|
|
|
|
gst_element_add_pad (b, gst_ghost_pad_new ("src", srcpad));
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
|
|
|
|
h = gst_harness_new_with_element (b, NULL, "src");
|
|
|
|
gst_harness_play (h);
|
|
|
|
|
|
|
|
gst_harness_crank_single_clock_wait (h);
|
|
|
|
gst_buffer_unref (gst_harness_pull (h));
|
|
|
|
|
|
|
|
gst_object_unref (b);
|
|
|
|
gst_harness_teardown (h);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST (test_activate_sink_and_src)
|
|
|
|
{
|
|
|
|
GstHarness *h;
|
|
|
|
GstElement *b;
|
|
|
|
GstElement *element;
|
|
|
|
GstPad *sinkpad;
|
|
|
|
GstPad *srcpad;
|
|
|
|
|
|
|
|
b = gst_bin_new (NULL);
|
|
|
|
element = gst_element_factory_make ("identity", NULL);
|
|
|
|
gst_bin_add (GST_BIN (b), element);
|
|
|
|
|
|
|
|
sinkpad = gst_element_get_static_pad (element, "sink");
|
|
|
|
gst_element_add_pad (b, gst_ghost_pad_new ("sink", sinkpad));
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
|
|
|
|
srcpad = gst_element_get_static_pad (element, "src");
|
|
|
|
gst_element_add_pad (b, gst_ghost_pad_new ("src", srcpad));
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
|
|
|
|
h = gst_harness_new_with_element (b, "sink", "src");
|
|
|
|
gst_harness_set_src_caps_str (h, "mycaps");
|
|
|
|
|
2016-02-17 14:25:08 +00:00
|
|
|
gst_harness_push (h, gst_buffer_new ());
|
2016-02-17 10:02:34 +00:00
|
|
|
gst_buffer_unref (gst_harness_pull (h));
|
|
|
|
|
|
|
|
gst_object_unref (b);
|
|
|
|
gst_harness_teardown (h);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2016-02-17 14:25:08 +00:00
|
|
|
GST_START_TEST (test_activate_src_pull_mode)
|
|
|
|
{
|
|
|
|
GstElement *b;
|
|
|
|
GstElement *src;
|
|
|
|
GstPad *srcpad;
|
|
|
|
GstPad *internalpad;
|
|
|
|
GstPad *ghost;
|
|
|
|
|
|
|
|
b = gst_bin_new (NULL);
|
|
|
|
src = gst_element_factory_make ("fakesrc", NULL);
|
|
|
|
gst_bin_add (GST_BIN (b), src);
|
|
|
|
|
|
|
|
srcpad = gst_element_get_static_pad (src, "src");
|
|
|
|
ghost = gst_ghost_pad_new ("src", srcpad);
|
|
|
|
gst_element_add_pad (b, ghost);
|
|
|
|
|
|
|
|
internalpad = (GstPad *) gst_proxy_pad_get_internal ((GstProxyPad *) ghost);
|
|
|
|
|
|
|
|
fail_if (GST_PAD_IS_ACTIVE (ghost));
|
|
|
|
fail_if (GST_PAD_IS_ACTIVE (internalpad));
|
|
|
|
fail_if (GST_PAD_IS_ACTIVE (srcpad));
|
|
|
|
fail_unless (gst_pad_activate_mode (ghost, GST_PAD_MODE_PULL, TRUE));
|
|
|
|
fail_unless (GST_PAD_IS_ACTIVE (ghost));
|
|
|
|
fail_unless (GST_PAD_IS_ACTIVE (internalpad));
|
|
|
|
fail_unless (GST_PAD_IS_ACTIVE (srcpad));
|
|
|
|
|
2016-02-29 02:06:50 +00:00
|
|
|
gst_object_unref (internalpad);
|
|
|
|
gst_object_unref (srcpad);
|
2016-02-17 14:25:08 +00:00
|
|
|
gst_object_unref (b);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST (test_activate_sink_switch_mode)
|
|
|
|
{
|
|
|
|
GstElement *pipeline;
|
|
|
|
GstElement *b, *src, *identity;
|
|
|
|
GstPad *srcpad, *sinkpad, *internalpad, *ghost;
|
|
|
|
|
|
|
|
pipeline = gst_pipeline_new (NULL);
|
|
|
|
b = gst_bin_new (NULL);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), b);
|
|
|
|
src = gst_element_factory_make ("fakesrc", NULL);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
identity = gst_element_factory_make ("identity", NULL);
|
|
|
|
gst_bin_add (GST_BIN (b), identity);
|
|
|
|
|
|
|
|
sinkpad = gst_element_get_static_pad (identity, "sink");
|
|
|
|
ghost = gst_ghost_pad_new ("sink", sinkpad);
|
|
|
|
gst_element_add_pad (b, ghost);
|
|
|
|
srcpad = gst_element_get_static_pad (src, "src");
|
|
|
|
gst_pad_link (srcpad, ghost);
|
|
|
|
|
|
|
|
internalpad = (GstPad *) gst_proxy_pad_get_internal ((GstProxyPad *) ghost);
|
|
|
|
|
|
|
|
/* We start with no active pads */
|
|
|
|
fail_if (GST_PAD_IS_ACTIVE (ghost));
|
|
|
|
fail_if (GST_PAD_IS_ACTIVE (internalpad));
|
|
|
|
fail_if (GST_PAD_IS_ACTIVE (sinkpad));
|
|
|
|
fail_if (GST_PAD_IS_ACTIVE (srcpad));
|
|
|
|
|
|
|
|
GST_DEBUG ("Activating pads in push mode");
|
|
|
|
/* Let's first try to activate everything in push-mode, for this we need
|
|
|
|
* to go on every exposed pad */
|
|
|
|
fail_unless (gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PUSH, TRUE));
|
|
|
|
fail_unless (gst_pad_activate_mode (ghost, GST_PAD_MODE_PUSH, TRUE));
|
|
|
|
fail_unless (gst_pad_activate_mode (srcpad, GST_PAD_MODE_PUSH, TRUE));
|
|
|
|
|
|
|
|
GST_DEBUG ("Checking pads are all activated properly");
|
|
|
|
/* Let's check all pads are now active, including internal ones */
|
|
|
|
fail_unless (GST_PAD_MODE (ghost) == GST_PAD_MODE_PUSH);
|
|
|
|
fail_unless (GST_PAD_MODE (internalpad) == GST_PAD_MODE_PUSH);
|
|
|
|
fail_unless (GST_PAD_MODE (srcpad) == GST_PAD_MODE_PUSH);
|
|
|
|
fail_unless (GST_PAD_MODE (sinkpad) == GST_PAD_MODE_PUSH);
|
|
|
|
|
|
|
|
/* Now simulate a scheduling reconfiguration (PUSH=>PULL) */
|
|
|
|
fail_unless (gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PULL, TRUE));
|
|
|
|
|
|
|
|
/* All pads should have switched modes */
|
|
|
|
fail_unless (GST_PAD_MODE (ghost) == GST_PAD_MODE_PULL);
|
|
|
|
fail_unless (GST_PAD_MODE (srcpad) == GST_PAD_MODE_PULL);
|
|
|
|
fail_unless (GST_PAD_MODE (sinkpad) == GST_PAD_MODE_PULL);
|
|
|
|
fail_unless (GST_PAD_MODE (internalpad) == GST_PAD_MODE_PULL);
|
|
|
|
|
|
|
|
gst_object_unref (internalpad);
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
gst_object_unref (pipeline);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2017-03-30 07:17:08 +00:00
|
|
|
static gboolean thread_running;
|
2017-08-18 12:30:32 +00:00
|
|
|
|
2017-03-30 07:17:08 +00:00
|
|
|
static gpointer
|
|
|
|
send_query_to_pad_func (GstPad * pad)
|
|
|
|
{
|
|
|
|
GstQuery *query = gst_query_new_latency ();
|
|
|
|
|
|
|
|
while (thread_running) {
|
|
|
|
gst_pad_peer_query (pad, query);
|
|
|
|
g_thread_yield ();
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_query_unref (query);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_stress_upstream_queries_while_tearing_down)
|
|
|
|
{
|
|
|
|
GThread *query_thread;
|
|
|
|
gint i;
|
|
|
|
GstPad *pad = gst_pad_new ("sink", GST_PAD_SINK);
|
|
|
|
gst_pad_set_active (pad, TRUE);
|
|
|
|
|
|
|
|
thread_running = TRUE;
|
|
|
|
query_thread = g_thread_new ("queries",
|
|
|
|
(GThreadFunc) send_query_to_pad_func, pad);
|
|
|
|
|
|
|
|
for (i = 0; i < 1000; i++) {
|
|
|
|
GstPad *ghostpad = gst_ghost_pad_new ("ghost-sink", pad);
|
|
|
|
gst_pad_set_active (ghostpad, TRUE);
|
|
|
|
|
|
|
|
g_thread_yield ();
|
|
|
|
|
|
|
|
gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (ghostpad), NULL);
|
|
|
|
gst_pad_set_active (pad, FALSE);
|
|
|
|
gst_object_unref (ghostpad);
|
|
|
|
}
|
|
|
|
|
|
|
|
thread_running = FALSE;
|
|
|
|
g_thread_join (query_thread);
|
|
|
|
|
|
|
|
gst_object_unref (pad);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2017-08-18 12:30:32 +00:00
|
|
|
GST_START_TEST (test_deactivate_already_deactive_with_no_parent)
|
|
|
|
{
|
|
|
|
/* This simulates the behavior where a ghostpad is released while
|
|
|
|
* deactivating (for instance because of a state change).
|
|
|
|
* gst_pad_activate_mode() may be be called from
|
|
|
|
* gst_ghost_pad_internal_activate_push_default() on a pad that is already
|
|
|
|
* deactivate and unparented. The call chain is really like somethink like
|
|
|
|
* this:
|
|
|
|
* gst_pad_activate_mode(ghostpad)
|
|
|
|
* -> ...
|
|
|
|
* -> gst_pad_activate_mode(proxypad)
|
|
|
|
* -> ...
|
|
|
|
* -> gst_pad_activate_mode(ghostpad)
|
|
|
|
*/
|
|
|
|
GstElement *bin = gst_bin_new ("testbin");
|
|
|
|
GstPad *pad = gst_ghost_pad_new_no_target ("src", GST_PAD_SRC);
|
|
|
|
gst_object_ref (pad);
|
|
|
|
|
|
|
|
/* We need to add/remove pad because that will update the pad's flags */
|
|
|
|
fail_unless (gst_element_add_pad (bin, pad));
|
|
|
|
fail_unless (gst_element_remove_pad (bin, pad));
|
|
|
|
|
|
|
|
/* Setting a pad that's already deactive to deactive should not fail. */
|
|
|
|
fail_if (gst_pad_is_active (pad));
|
|
|
|
fail_unless (gst_pad_activate_mode (pad, GST_PAD_MODE_PUSH, FALSE));
|
|
|
|
|
|
|
|
gst_object_unref (bin);
|
|
|
|
gst_object_unref (pad);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2008-02-29 13:59:24 +00:00
|
|
|
static Suite *
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_ghost_pad_suite (void)
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
{
|
|
|
|
Suite *s = suite_create ("GstGhostPad");
|
2008-06-24 07:49:36 +00:00
|
|
|
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
TCase *tc_chain = tcase_create ("ghost pad tests");
|
|
|
|
|
|
|
|
suite_add_tcase (s, tc_chain);
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
tcase_add_test (tc_chain, test_remove1);
|
check/gst/gstghostpad.c: Added test for removing an element with ghostpad from a bin.
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added test for removing an element with ghostpad from a bin.
Fixed test as current implementation does the right thing.
* gst/gstghostpad.c: (gst_proxy_pad_class_init),
(gst_proxy_pad_do_query_type), (gst_proxy_pad_do_event),
(gst_proxy_pad_do_query), (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_do_bufferalloc), (gst_proxy_pad_do_activate),
(gst_proxy_pad_do_activatepull), (gst_proxy_pad_do_activatepush),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target),
(gst_proxy_pad_get_target), (gst_proxy_pad_init),
(gst_proxy_pad_dispose), (gst_proxy_pad_finalize),
(gst_ghost_pad_class_init), (gst_ghost_pad_do_activate_push),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_set_internal), (gst_ghost_pad_dispose),
(gst_ghost_pad_new_notarget), (gst_ghost_pad_new),
(gst_ghost_pad_get_target), (gst_ghost_pad_set_target):
* gst/gstghostpad.h:
Clean up ghostpads, remove properties for internal stuff.
Make threadsafe.
Fix refcounting.
Prepare for switching targets, not all use cases work yet.
2005-07-29 19:22:28 +00:00
|
|
|
tcase_add_test (tc_chain, test_remove2);
|
2009-02-16 11:58:34 +00:00
|
|
|
tcase_add_test (tc_chain, test_remove_target);
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
tcase_add_test (tc_chain, test_link);
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
tcase_add_test (tc_chain, test_ghost_pads);
|
2005-11-10 09:19:12 +00:00
|
|
|
tcase_add_test (tc_chain, test_ghost_pads_bin);
|
docs/design/part-gstghostpad.txt: Update ascii art in documentation.
Original commit message from CVS:
* docs/design/part-gstghostpad.txt:
Update ascii art in documentation.
* gst/gstghostpad.c: (gst_proxy_pad_do_internal_link),
(gst_proxy_pad_set_target_unlocked), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_set_target):
Small cleanups and leak fixes.
Remove some checks now that the internal pad is never NULL.
Fix the case where linking pads without a target would create nasty
criticals. Fixes #341029.
Don't assign a GstPadLinkReturn to a gboolean and mess up the return
value of _set_target().
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Some more tests for creating and linking untargeted ghostpads.
2006-08-31 15:19:44 +00:00
|
|
|
tcase_add_test (tc_chain, test_ghost_pads_notarget);
|
2006-06-20 08:40:40 +00:00
|
|
|
tcase_add_test (tc_chain, test_ghost_pads_block);
|
|
|
|
tcase_add_test (tc_chain, test_ghost_pads_probes);
|
Refactored *_new() functions.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstghostpad.c: (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_dispose), (gst_ghost_pad_new_full),
(gst_ghost_pad_new_no_target), (gst_ghost_pad_new),
(gst_ghost_pad_new_from_template),
(gst_ghost_pad_new_no_target_from_template):
* gst/gstghostpad.h:
Refactored *_new() functions.
Templates are now used as a g_object_new() parameter.
Use template in _do_getcaps() if we don't have a target.
Small documentation cleanups.
Added two new constructors:
gst_ghost_pad_new_from_template()
gst_ghost_pad_new_no_target_from_template()
* tests/check/gst/gstghostpad.c: (GST_START_TEST),
(gst_ghost_pad_suite):
Added tests for new ghostpad instanciation functions.
API additions: gst_ghost_pad_new_from_template,
gst_ghost_pad_new_no_target_from_template
2006-08-31 10:59:11 +00:00
|
|
|
tcase_add_test (tc_chain, test_ghost_pads_new_from_template);
|
|
|
|
tcase_add_test (tc_chain, test_ghost_pads_new_no_target_from_template);
|
2008-12-17 16:16:45 +00:00
|
|
|
tcase_add_test (tc_chain, test_ghost_pads_forward_setcaps);
|
2009-01-21 11:21:49 +00:00
|
|
|
tcase_add_test (tc_chain, test_ghost_pads_sink_link_unlink);
|
|
|
|
tcase_add_test (tc_chain, test_ghost_pads_src_link_unlink);
|
2009-09-26 20:43:37 +00:00
|
|
|
tcase_add_test (tc_chain, test_ghost_pads_change_when_linked);
|
2011-10-25 21:26:50 +00:00
|
|
|
tcase_add_test (tc_chain, test_ghost_pads_internal_link);
|
2012-09-25 18:44:54 +00:00
|
|
|
tcase_add_test (tc_chain, test_ghost_pads_remove_while_playing);
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
|
2016-02-17 10:02:34 +00:00
|
|
|
tcase_add_test (tc_chain, test_activate_src);
|
|
|
|
tcase_add_test (tc_chain, test_activate_sink_and_src);
|
2016-02-17 14:25:08 +00:00
|
|
|
tcase_add_test (tc_chain, test_activate_src_pull_mode);
|
|
|
|
tcase_add_test (tc_chain, test_activate_sink_switch_mode);
|
2017-08-18 12:30:32 +00:00
|
|
|
tcase_add_test (tc_chain, test_deactivate_already_deactive_with_no_parent);
|
2017-03-30 07:17:08 +00:00
|
|
|
tcase_add_test (tc_chain, test_stress_upstream_queries_while_tearing_down);
|
2016-02-17 10:02:34 +00:00
|
|
|
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2006-07-01 20:56:56 +00:00
|
|
|
GST_CHECK_MAIN (gst_ghost_pad);
|