mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-15 13:53:19 +00:00
Fix pad_get_direction wrt ghostpads.
Original commit message from CVS: * gst/gstpad.c: (gst_pad_get_direction): * gst/gstpad.h: * testsuite/bins/interface.c: (main): * testsuite/refcounting/bin.c: (add_remove_test1), (add_remove_test2), (main): * testsuite/refcounting/element.c: (main): * testsuite/refcounting/element_pad.c: (main): * testsuite/refcounting/pad.c: (main): Fix pad_get_direction wrt ghostpads. Fix some more testsuites.
This commit is contained in:
parent
5d498183bc
commit
fdcf9acd4b
13 changed files with 69 additions and 45 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2005-03-09 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/gstpad.c: (gst_pad_get_direction):
|
||||
* gst/gstpad.h:
|
||||
* testsuite/bins/interface.c: (main):
|
||||
* testsuite/refcounting/bin.c: (add_remove_test1),
|
||||
(add_remove_test2), (main):
|
||||
* testsuite/refcounting/element.c: (main):
|
||||
* testsuite/refcounting/element_pad.c: (main):
|
||||
* testsuite/refcounting/pad.c: (main):
|
||||
Fix pad_get_direction wrt ghostpads.
|
||||
Fix some more testsuites.
|
||||
|
||||
2005-03-09 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_set_index_func),
|
||||
|
|
15
gst/gstpad.c
15
gst/gstpad.c
|
@ -415,16 +415,23 @@ GstPadDirection
|
|||
gst_pad_get_direction (GstPad * pad)
|
||||
{
|
||||
GstPadDirection result;
|
||||
GstRealPad *realpad;
|
||||
|
||||
/* pad unkown is a little silly but we need some sort of
|
||||
/* PAD_UNKNOWN is a little silly but we need some sort of
|
||||
* error return value */
|
||||
g_return_val_if_fail (GST_IS_PAD (pad), GST_PAD_UNKNOWN);
|
||||
|
||||
/* since the direction cannot change at runtime we can
|
||||
* safely read without locking. */
|
||||
result = GST_PAD_DIRECTION (pad);
|
||||
GST_PAD_REALIZE_AND_LOCK (pad, realpad, lost_ghostpad);
|
||||
result = GST_RPAD_DIRECTION (realpad);
|
||||
GST_UNLOCK (realpad);
|
||||
|
||||
return result;
|
||||
|
||||
/* errors */
|
||||
lost_ghostpad:
|
||||
{
|
||||
return GST_PAD_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -357,7 +357,7 @@ struct _GstGhostPadClass {
|
|||
/* GstGhostPad */
|
||||
#define GST_GPAD_REALPAD(pad) (((GstGhostPad *)(pad))->realpad)
|
||||
|
||||
/* Generic */
|
||||
/* Generic, be VERY carefull with these macros as the ghostpad could be lost */
|
||||
#define GST_PAD_REALIZE(pad) (GST_IS_REAL_PAD(pad) ? ((GstRealPad *)(pad)) : GST_GPAD_REALPAD(pad))
|
||||
#define GST_PAD_DIRECTION(pad) GST_RPAD_DIRECTION(GST_PAD_REALIZE(pad))
|
||||
#define GST_PAD_CAPS(pad) GST_RPAD_CAPS(GST_PAD_REALIZE (pad))
|
||||
|
|
|
@ -25,8 +25,8 @@ gint
|
|||
main (gint argc, gchar * argv[])
|
||||
{
|
||||
GstBin *bin, *bin2;
|
||||
GstIterator *it;
|
||||
GstElement *filesrc;
|
||||
GstIterator *it;
|
||||
gpointer item;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
@ -41,6 +41,7 @@ main (gint argc, gchar * argv[])
|
|||
|
||||
g_assert (gst_bin_get_by_interface (bin, GST_TYPE_URI_HANDLER) == filesrc);
|
||||
it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER);
|
||||
g_assert (it != NULL);
|
||||
g_assert (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
||||
g_assert (item == (gpointer) filesrc);
|
||||
g_assert (gst_iterator_next (it, &item) == GST_ITERATOR_DONE);
|
||||
|
@ -52,6 +53,7 @@ main (gint argc, gchar * argv[])
|
|||
gst_element_factory_make ("identity", NULL), NULL);
|
||||
g_assert (gst_bin_get_by_interface (bin, GST_TYPE_URI_HANDLER) == filesrc);
|
||||
it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER);
|
||||
g_assert (it != NULL);
|
||||
g_assert (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
||||
g_assert (item == (gpointer) filesrc);
|
||||
g_assert (gst_iterator_next (it, &item) == GST_ITERATOR_DONE);
|
||||
|
|
|
@ -50,9 +50,9 @@ add_remove_test1 (void)
|
|||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test1");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
g_assert (GST_OBJECT_IS_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_IS_FLOATING (element));
|
||||
gst_bin_remove (GST_BIN (bin), element);
|
||||
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
|
@ -68,16 +68,16 @@ add_remove_test2 (void)
|
|||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test1");
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
g_assert (GST_OBJECT_IS_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_IS_FLOATING (element));
|
||||
gst_bin_remove (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_DESTROYED (element));
|
||||
g_assert (!GST_OBJECT_IS_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_IS_DESTROYED (element));
|
||||
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
#if 0
|
||||
g_assert (GST_OBJECT_DESTROYED (element));
|
||||
g_assert (GST_OBJECT_IS_DESTROYED (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
#endif
|
||||
|
||||
|
@ -169,10 +169,10 @@ main (int argc, gchar * argv[])
|
|||
gst_alloc_trace_live_all () - usage1);
|
||||
|
||||
bin = gst_bin_new ("somebin");
|
||||
g_assert (GST_OBJECT_FLOATING (bin));
|
||||
g_assert (GST_OBJECT_IS_FLOATING (bin));
|
||||
gst_object_ref (GST_OBJECT (bin));
|
||||
gst_object_sink (GST_OBJECT (bin));
|
||||
g_assert (!GST_OBJECT_FLOATING (bin));
|
||||
g_assert (!GST_OBJECT_IS_FLOATING (bin));
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
g_print ("create/ref/sink/unref new bin %d\n",
|
||||
gst_alloc_trace_live_all () - usage1);
|
||||
|
@ -188,10 +188,10 @@ main (int argc, gchar * argv[])
|
|||
gst_alloc_trace_live_all () - usage1);
|
||||
|
||||
bin = gst_bin_new ("somebin");
|
||||
g_assert (!GST_OBJECT_DESTROYED (bin));
|
||||
g_assert (!GST_OBJECT_IS_DESTROYED (bin));
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
#if 0
|
||||
g_assert (GST_OBJECT_DESTROYED (bin));
|
||||
g_assert (GST_OBJECT_IS_DESTROYED (bin));
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
#endif
|
||||
g_print ("create/destroy/unref new bin %d\n",
|
||||
|
|
|
@ -35,10 +35,10 @@ main (int argc, gchar * argv[])
|
|||
gst_alloc_trace_live_all () - usage1);
|
||||
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
g_assert (GST_OBJECT_IS_FLOATING (element));
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_sink (GST_OBJECT (element));
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_IS_FLOATING (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
g_print ("create/ref/sink/unref new element %d\n",
|
||||
gst_alloc_trace_live_all () - usage1);
|
||||
|
@ -55,9 +55,9 @@ main (int argc, gchar * argv[])
|
|||
|
||||
#if 0
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
g_assert (!GST_OBJECT_DESTROYED (element));
|
||||
g_assert (!GST_OBJECT_IS_DESTROYED (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_DESTROYED (element));
|
||||
g_assert (GST_OBJECT_IS_DESTROYED (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
g_print ("create/destroy/unref new element %d\n",
|
||||
gst_alloc_trace_live_all () - usage1);
|
||||
|
|
|
@ -27,8 +27,8 @@ main (int argc, gchar * argv[])
|
|||
g_assert (GST_IS_ELEMENT (element));
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
g_assert (GST_IS_PAD (pad));
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_FLOATING (pad));
|
||||
g_assert (GST_OBJECT_IS_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_IS_FLOATING (pad));
|
||||
g_assert (gst_pad_get_parent (pad) == element);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
g_print ("create/addpad/unref 1 new element: %ld\n", vmsize () - usage1);
|
||||
|
|
|
@ -52,10 +52,10 @@ main (int argc, gchar * argv[])
|
|||
pad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get (&templ),
|
||||
"padname");
|
||||
g_assert (GST_OBJECT_FLOATING (pad));
|
||||
g_assert (GST_OBJECT_IS_FLOATING (pad));
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
gst_object_sink (GST_OBJECT (pad));
|
||||
g_assert (!GST_OBJECT_FLOATING (pad));
|
||||
g_assert (!GST_OBJECT_IS_FLOATING (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
g_print ("create/ref/sink/unref new pad %ld\n", vmsize () - usage1);
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ gint
|
|||
main (gint argc, gchar * argv[])
|
||||
{
|
||||
GstBin *bin, *bin2;
|
||||
GstIterator *it;
|
||||
GstElement *filesrc;
|
||||
GstIterator *it;
|
||||
gpointer item;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
@ -41,6 +41,7 @@ main (gint argc, gchar * argv[])
|
|||
|
||||
g_assert (gst_bin_get_by_interface (bin, GST_TYPE_URI_HANDLER) == filesrc);
|
||||
it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER);
|
||||
g_assert (it != NULL);
|
||||
g_assert (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
||||
g_assert (item == (gpointer) filesrc);
|
||||
g_assert (gst_iterator_next (it, &item) == GST_ITERATOR_DONE);
|
||||
|
@ -52,6 +53,7 @@ main (gint argc, gchar * argv[])
|
|||
gst_element_factory_make ("identity", NULL), NULL);
|
||||
g_assert (gst_bin_get_by_interface (bin, GST_TYPE_URI_HANDLER) == filesrc);
|
||||
it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER);
|
||||
g_assert (it != NULL);
|
||||
g_assert (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
||||
g_assert (item == (gpointer) filesrc);
|
||||
g_assert (gst_iterator_next (it, &item) == GST_ITERATOR_DONE);
|
||||
|
|
|
@ -50,9 +50,9 @@ add_remove_test1 (void)
|
|||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test1");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
g_assert (GST_OBJECT_IS_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_IS_FLOATING (element));
|
||||
gst_bin_remove (GST_BIN (bin), element);
|
||||
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
|
@ -68,16 +68,16 @@ add_remove_test2 (void)
|
|||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test1");
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
g_assert (GST_OBJECT_IS_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_IS_FLOATING (element));
|
||||
gst_bin_remove (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_DESTROYED (element));
|
||||
g_assert (!GST_OBJECT_IS_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_IS_DESTROYED (element));
|
||||
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
#if 0
|
||||
g_assert (GST_OBJECT_DESTROYED (element));
|
||||
g_assert (GST_OBJECT_IS_DESTROYED (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
#endif
|
||||
|
||||
|
@ -169,10 +169,10 @@ main (int argc, gchar * argv[])
|
|||
gst_alloc_trace_live_all () - usage1);
|
||||
|
||||
bin = gst_bin_new ("somebin");
|
||||
g_assert (GST_OBJECT_FLOATING (bin));
|
||||
g_assert (GST_OBJECT_IS_FLOATING (bin));
|
||||
gst_object_ref (GST_OBJECT (bin));
|
||||
gst_object_sink (GST_OBJECT (bin));
|
||||
g_assert (!GST_OBJECT_FLOATING (bin));
|
||||
g_assert (!GST_OBJECT_IS_FLOATING (bin));
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
g_print ("create/ref/sink/unref new bin %d\n",
|
||||
gst_alloc_trace_live_all () - usage1);
|
||||
|
@ -188,10 +188,10 @@ main (int argc, gchar * argv[])
|
|||
gst_alloc_trace_live_all () - usage1);
|
||||
|
||||
bin = gst_bin_new ("somebin");
|
||||
g_assert (!GST_OBJECT_DESTROYED (bin));
|
||||
g_assert (!GST_OBJECT_IS_DESTROYED (bin));
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
#if 0
|
||||
g_assert (GST_OBJECT_DESTROYED (bin));
|
||||
g_assert (GST_OBJECT_IS_DESTROYED (bin));
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
#endif
|
||||
g_print ("create/destroy/unref new bin %d\n",
|
||||
|
|
|
@ -35,10 +35,10 @@ main (int argc, gchar * argv[])
|
|||
gst_alloc_trace_live_all () - usage1);
|
||||
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
g_assert (GST_OBJECT_IS_FLOATING (element));
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_sink (GST_OBJECT (element));
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_IS_FLOATING (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
g_print ("create/ref/sink/unref new element %d\n",
|
||||
gst_alloc_trace_live_all () - usage1);
|
||||
|
@ -55,9 +55,9 @@ main (int argc, gchar * argv[])
|
|||
|
||||
#if 0
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
g_assert (!GST_OBJECT_DESTROYED (element));
|
||||
g_assert (!GST_OBJECT_IS_DESTROYED (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_DESTROYED (element));
|
||||
g_assert (GST_OBJECT_IS_DESTROYED (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
g_print ("create/destroy/unref new element %d\n",
|
||||
gst_alloc_trace_live_all () - usage1);
|
||||
|
|
|
@ -27,8 +27,8 @@ main (int argc, gchar * argv[])
|
|||
g_assert (GST_IS_ELEMENT (element));
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
g_assert (GST_IS_PAD (pad));
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_FLOATING (pad));
|
||||
g_assert (GST_OBJECT_IS_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_IS_FLOATING (pad));
|
||||
g_assert (gst_pad_get_parent (pad) == element);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
g_print ("create/addpad/unref 1 new element: %ld\n", vmsize () - usage1);
|
||||
|
|
|
@ -52,10 +52,10 @@ main (int argc, gchar * argv[])
|
|||
pad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get (&templ),
|
||||
"padname");
|
||||
g_assert (GST_OBJECT_FLOATING (pad));
|
||||
g_assert (GST_OBJECT_IS_FLOATING (pad));
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
gst_object_sink (GST_OBJECT (pad));
|
||||
g_assert (!GST_OBJECT_FLOATING (pad));
|
||||
g_assert (!GST_OBJECT_IS_FLOATING (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
g_print ("create/ref/sink/unref new pad %ld\n", vmsize () - usage1);
|
||||
|
||||
|
|
Loading…
Reference in a new issue