From 4e4a1aabe59d4ac36bf155ce141244f0aa4cfe76 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 19 May 2003 15:46:39 +0000 Subject: [PATCH] check if required elements are installed Original commit message from CVS: check if required elements are installed --- common | 2 +- tests/old/testsuite/refcounting/sched.c | 20 +++++++++++++++++--- testsuite/refcounting/sched.c | 20 +++++++++++++++++--- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/common b/common index 5cca5dd..54aa761 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 5cca5ddc23e23658e8287f7c2fbc4aebddaf3e12 +Subproject commit 54aa761f9d486bca3ee35029a110386a144340c5 diff --git a/tests/old/testsuite/refcounting/sched.c b/tests/old/testsuite/refcounting/sched.c index a9e8629..fae8b7b 100644 --- a/tests/old/testsuite/refcounting/sched.c +++ b/tests/old/testsuite/refcounting/sched.c @@ -4,6 +4,19 @@ gint i = 0; GstElement *pipeline; GstPadChainFunction oss_chain; +static GstElement * +make_and_check_element (gchar *type, gchar *name) +{ + GstElement *element = gst_element_factory_make (type, name); + + if (element == NULL) { + g_warning ("Could not run test, because element type \"%s\" is not installed. Please retry when it is. Asysuming it works for now...", type); + exit (0); + } + + return element; +} + static void create_pipeline (void) { @@ -12,12 +25,13 @@ create_pipeline (void) GstElement *id; pipeline = gst_pipeline_new ("pipeline"); - src = gst_element_factory_make ("sinesrc", "src"); + src = make_and_check_element ("sinesrc", "src"); /** * You need a sink with a loop-based element in here, if you want to kill opt, too. * Osssink (chain-based) only breaks the basic scheduler. */ - sink = gst_element_factory_make ("alsasink", "sink"); + sink = make_and_check_element ("alsasink", "sink"); + gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); gst_element_link (src, sink); @@ -30,7 +44,7 @@ create_pipeline (void) * And no, it's not because of identity, you may use any other element. */ gst_element_unlink (src, sink); - id = gst_element_factory_make ("identity", "id"); + id = make_and_check_element ("identity", "id"); gst_bin_add (GST_BIN (pipeline), id); gst_element_link_many (src, id, sink, NULL); diff --git a/testsuite/refcounting/sched.c b/testsuite/refcounting/sched.c index a9e8629..fae8b7b 100644 --- a/testsuite/refcounting/sched.c +++ b/testsuite/refcounting/sched.c @@ -4,6 +4,19 @@ gint i = 0; GstElement *pipeline; GstPadChainFunction oss_chain; +static GstElement * +make_and_check_element (gchar *type, gchar *name) +{ + GstElement *element = gst_element_factory_make (type, name); + + if (element == NULL) { + g_warning ("Could not run test, because element type \"%s\" is not installed. Please retry when it is. Asysuming it works for now...", type); + exit (0); + } + + return element; +} + static void create_pipeline (void) { @@ -12,12 +25,13 @@ create_pipeline (void) GstElement *id; pipeline = gst_pipeline_new ("pipeline"); - src = gst_element_factory_make ("sinesrc", "src"); + src = make_and_check_element ("sinesrc", "src"); /** * You need a sink with a loop-based element in here, if you want to kill opt, too. * Osssink (chain-based) only breaks the basic scheduler. */ - sink = gst_element_factory_make ("alsasink", "sink"); + sink = make_and_check_element ("alsasink", "sink"); + gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); gst_element_link (src, sink); @@ -30,7 +44,7 @@ create_pipeline (void) * And no, it's not because of identity, you may use any other element. */ gst_element_unlink (src, sink); - id = gst_element_factory_make ("identity", "id"); + id = make_and_check_element ("identity", "id"); gst_bin_add (GST_BIN (pipeline), id); gst_element_link_many (src, id, sink, NULL); -- 2.7.4