diff --git a/tests/old/testsuite/refcounting/Makefile.am b/tests/old/testsuite/refcounting/Makefile.am index 7efde99364..21f3fa79f0 100644 --- a/tests/old/testsuite/refcounting/Makefile.am +++ b/tests/old/testsuite/refcounting/Makefile.am @@ -1,9 +1,11 @@ SUBDIRS = -testprogs = object element +testprogs = object element pad element_pad object_SOURCES = object.c mem.c element_SOURCES = element.c mem.c +pad_SOURCES = pad.c mem.c +element_pad_SOURCES = element_pad.c mem.c TESTS = $(testprogs) diff --git a/tests/old/testsuite/refcounting/element_pad.c b/tests/old/testsuite/refcounting/element_pad.c new file mode 100644 index 0000000000..d40aa14b33 --- /dev/null +++ b/tests/old/testsuite/refcounting/element_pad.c @@ -0,0 +1,70 @@ +#include + +#define ITERS 100000 +#include "mem.h" + +static void +print_pad_props (GstPad *pad) +{ + g_print ("name %s\n", gst_pad_get_name (pad)); + g_print ("flags 0x%08x\n", GST_FLAGS (pad)); +} + +static GstElement* +create_element (gchar *padname, GstPadDirection dir) +{ + GstElement *element; + GstPad *pad; + + element = gst_element_new (); + pad = gst_pad_new (padname, dir); + gst_element_add_pad (element, pad); + + return element; +} + +int +main (int argc, gchar *argv[]) +{ + GstElement *element; + GstElement *element2; + GstPad *pad; + long usage1; + gint i; + + gst_init (&argc, &argv); + + g_print ("creating new element\n"); + element = gst_element_new (); + usage1 = vmsize(); + + pad = gst_pad_new ("sink", GST_PAD_SINK); + print_pad_props (pad); + gst_element_add_pad (element, pad); + print_pad_props (pad); + + g_print ("unref new element %ld\n", vmsize()-usage1); + gst_object_unref (GST_OBJECT (element)); + + for (i=0; i + +#define ITERS 100000 +#include "mem.h" + +static void +print_pad_props (GstPad *pad) +{ + g_print ("name %s\n", gst_pad_get_name (pad)); + g_print ("flags 0x%08x\n", GST_FLAGS (pad)); +} + +int +main (int argc, gchar *argv[]) +{ + GstPad *pad; + GstPad *pad2; + GstPadTemplate *padtempl; + long usage1; + gint i; + + gst_init (&argc, &argv); + + g_print ("creating new pad\n"); + pad = gst_pad_new ("padname", GST_PAD_SINK); + usage1 = vmsize(); + print_pad_props (pad); + g_print ("unref new pad %ld\n", vmsize()-usage1); + gst_object_unref (GST_OBJECT (pad)); + + g_print ("creating new pad\n"); + pad = gst_pad_new ("padname", GST_PAD_SINK); + g_assert (GST_OBJECT_FLOATING (pad)); + print_pad_props (pad); + g_print ("sink new pad %ld\n", vmsize()-usage1); + gst_object_ref (GST_OBJECT (pad)); + gst_object_sink (GST_OBJECT (pad)); + g_assert (!GST_OBJECT_FLOATING (pad)); + print_pad_props (pad); + g_print ("unref new pad %ld\n", vmsize()-usage1); + gst_object_unref (GST_OBJECT (pad)); + + for (i=0; i + +#define ITERS 100000 +#include "mem.h" + +static void +print_pad_props (GstPad *pad) +{ + g_print ("name %s\n", gst_pad_get_name (pad)); + g_print ("flags 0x%08x\n", GST_FLAGS (pad)); +} + +static GstElement* +create_element (gchar *padname, GstPadDirection dir) +{ + GstElement *element; + GstPad *pad; + + element = gst_element_new (); + pad = gst_pad_new (padname, dir); + gst_element_add_pad (element, pad); + + return element; +} + +int +main (int argc, gchar *argv[]) +{ + GstElement *element; + GstElement *element2; + GstPad *pad; + long usage1; + gint i; + + gst_init (&argc, &argv); + + g_print ("creating new element\n"); + element = gst_element_new (); + usage1 = vmsize(); + + pad = gst_pad_new ("sink", GST_PAD_SINK); + print_pad_props (pad); + gst_element_add_pad (element, pad); + print_pad_props (pad); + + g_print ("unref new element %ld\n", vmsize()-usage1); + gst_object_unref (GST_OBJECT (element)); + + for (i=0; i + +#define ITERS 100000 +#include "mem.h" + +static void +print_pad_props (GstPad *pad) +{ + g_print ("name %s\n", gst_pad_get_name (pad)); + g_print ("flags 0x%08x\n", GST_FLAGS (pad)); +} + +int +main (int argc, gchar *argv[]) +{ + GstPad *pad; + GstPad *pad2; + GstPadTemplate *padtempl; + long usage1; + gint i; + + gst_init (&argc, &argv); + + g_print ("creating new pad\n"); + pad = gst_pad_new ("padname", GST_PAD_SINK); + usage1 = vmsize(); + print_pad_props (pad); + g_print ("unref new pad %ld\n", vmsize()-usage1); + gst_object_unref (GST_OBJECT (pad)); + + g_print ("creating new pad\n"); + pad = gst_pad_new ("padname", GST_PAD_SINK); + g_assert (GST_OBJECT_FLOATING (pad)); + print_pad_props (pad); + g_print ("sink new pad %ld\n", vmsize()-usage1); + gst_object_ref (GST_OBJECT (pad)); + gst_object_sink (GST_OBJECT (pad)); + g_assert (!GST_OBJECT_FLOATING (pad)); + print_pad_props (pad); + g_print ("unref new pad %ld\n", vmsize()-usage1); + gst_object_unref (GST_OBJECT (pad)); + + for (i=0; i