From e2a946395a956490c1d30922576edf1aac0d2526 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 10 Oct 2005 16:43:32 +0000 Subject: [PATCH] tests/sched/: Original commit message from CVS: * tests/sched/Makefile.am: * tests/sched/sort.c: (make_pipeline1), (make_pipeline2), (make_pipeline3), (make_pipeline4), (print_elem), (main): --- ChangeLog | 6 ++ tests/sched/Makefile.am | 2 +- tests/sched/sort.c | 160 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 tests/sched/sort.c diff --git a/ChangeLog b/ChangeLog index 7e2f4ce..d54ed53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-10-10 Wim Taymans + + * tests/sched/Makefile.am: + * tests/sched/sort.c: (make_pipeline1), (make_pipeline2), + (make_pipeline3), (make_pipeline4), (print_elem), (main): + 2005-10-10 Thomas Vander Stichele * gst/gstutils.c: (guint64_to_gdouble), (gst_util_uint64_scale): diff --git a/tests/sched/Makefile.am b/tests/sched/Makefile.am index e929e06..9230080 100644 --- a/tests/sched/Makefile.am +++ b/tests/sched/Makefile.am @@ -1,7 +1,7 @@ if GST_DISABLE_LOADSAVE noinst_PROGRAMS = else -noinst_PROGRAMS = runxml dynamic-pipeline sched-stress interrupt1 interrupt2 interrupt3 +noinst_PROGRAMS = runxml dynamic-pipeline sched-stress interrupt1 interrupt2 interrupt3 sort endif dynamic_pipeline_SOURCES = dynamic-pipeline.c diff --git a/tests/sched/sort.c b/tests/sched/sort.c new file mode 100644 index 0000000..b674635 --- /dev/null +++ b/tests/sched/sort.c @@ -0,0 +1,160 @@ +#include + +static GstElement * +make_pipeline1 () +{ + GstElement *fakesrc, *fakesink; + GstElement *pipeline; + + pipeline = gst_pipeline_new ("pipeline"); + g_assert (pipeline != NULL); + + fakesrc = gst_element_factory_make ("fakesrc", "fake_source"); + g_assert (fakesrc != NULL); + + fakesink = gst_element_factory_make ("fakesink", "fake_sink"); + g_assert (fakesink != NULL); + + gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL); + gst_element_link (fakesrc, fakesink); + + return pipeline; +} + +static GstElement * +make_pipeline2 () +{ + GstElement *fakesrc, *tee, *fakesink1, *fakesink2; + GstElement *pipeline; + + pipeline = gst_pipeline_new ("pipeline"); + g_assert (pipeline != NULL); + + fakesrc = gst_element_factory_make ("fakesrc", "fake_source"); + g_assert (fakesrc != NULL); + + tee = gst_element_factory_make ("tee", "tee"); + g_assert (tee != NULL); + + fakesink1 = gst_element_factory_make ("fakesink", "fake_sink1"); + g_assert (fakesink1 != NULL); + + fakesink2 = gst_element_factory_make ("fakesink", "fake_sink2"); + g_assert (fakesink2 != NULL); + + gst_bin_add_many (GST_BIN (pipeline), fakesrc, tee, fakesink1, fakesink2, + NULL); + gst_element_link (fakesrc, tee); + gst_element_link (tee, fakesink1); + gst_element_link (tee, fakesink2); + + return pipeline; +} + +static GstElement * +make_pipeline3 () +{ + GstElement *fakesrc, *tee, *identity, *fakesink1, *fakesink2; + GstElement *pipeline; + + pipeline = gst_pipeline_new ("pipeline"); + g_assert (pipeline != NULL); + + fakesrc = gst_element_factory_make ("fakesrc", "fake_source"); + g_assert (fakesrc != NULL); + + tee = gst_element_factory_make ("tee", "tee"); + g_assert (tee != NULL); + + identity = gst_element_factory_make ("identity", "identity"); + g_assert (identity != NULL); + + fakesink1 = gst_element_factory_make ("fakesink", "fake_sink1"); + g_assert (fakesink1 != NULL); + + fakesink2 = gst_element_factory_make ("fakesink", "fake_sink2"); + g_assert (fakesink2 != NULL); + + gst_bin_add_many (GST_BIN (pipeline), fakesrc, tee, identity, + fakesink1, fakesink2, NULL); + gst_element_link (fakesrc, tee); + gst_element_link (tee, identity); + gst_element_link (identity, fakesink1); + gst_element_link (tee, fakesink2); + + return pipeline; +} + +static GstElement * +make_pipeline4 () +{ + GstElement *fakesrc, *tee, *identity, *fakesink1, *fakesink2; + GstElement *pipeline; + + pipeline = gst_pipeline_new ("pipeline"); + g_assert (pipeline != NULL); + + fakesrc = gst_element_factory_make ("fakesrc", "fake_source"); + g_assert (fakesrc != NULL); + + tee = gst_element_factory_make ("tee", "tee"); + g_assert (tee != NULL); + + identity = gst_element_factory_make ("identity", "identity"); + g_assert (identity != NULL); + + fakesink1 = gst_element_factory_make ("fakesink", "fake_sink1"); + g_assert (fakesink1 != NULL); + + fakesink2 = gst_element_factory_make ("fakesink", "fake_sink2"); + g_assert (fakesink2 != NULL); + + gst_bin_add_many (GST_BIN (pipeline), fakesrc, tee, identity, + fakesink1, fakesink2, NULL); + gst_element_link (fakesrc, tee); + gst_element_link (identity, fakesink1); + + return pipeline; +} + +static void +print_elem (GstElement * elem, gpointer unused) +{ + g_print ("----> %s\n", GST_ELEMENT_NAME (elem)); + gst_object_unref (elem); +} + +int +main (int argc, gchar * argv[]) +{ + GstElement *bin; + GstIterator *it; + + gst_init (&argc, &argv); + + g_print ("pipeline 1\n"); + bin = make_pipeline1 (); + it = gst_bin_iterate_sorted (GST_BIN (bin)); + gst_iterator_foreach (it, (GFunc) print_elem, NULL); + gst_iterator_free (it); + + g_print ("pipeline 2\n"); + bin = make_pipeline2 (); + it = gst_bin_iterate_sorted (GST_BIN (bin)); + gst_iterator_foreach (it, (GFunc) print_elem, NULL); + gst_iterator_free (it); + + g_print ("pipeline 3\n"); + bin = make_pipeline3 (); + it = gst_bin_iterate_sorted (GST_BIN (bin)); + gst_iterator_foreach (it, (GFunc) print_elem, NULL); + gst_iterator_free (it); + + g_print ("pipeline 4\n"); + bin = make_pipeline4 (); + it = gst_bin_iterate_sorted (GST_BIN (bin)); + gst_iterator_foreach (it, (GFunc) print_elem, NULL); + gst_iterator_free (it); + + return 0; +} -- 2.7.4