summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2013-11-01 16:35:59 +0000
committerOlivier CrĂȘte <olivier.crete@collabora.com>2013-11-01 17:02:25 +0000
commit789eda5a37bd63a7a192b694af1c8824720be949 (patch)
tree6e6588fb2f2163d9ae769c08451c31103f65c643
parenta0e2eb61692c56edc84de378119c353d828bc577 (diff)
parse: Make the FATAL_ERRORS flag also work without a GError
Also add a unit tests
-rw-r--r--gst/gstparse.c9
-rw-r--r--tests/check/pipelines/parse-launch.c5
2 files changed, 12 insertions, 2 deletions
diff --git a/gst/gstparse.c b/gst/gstparse.c
index a23cafa5e..75c6aa5c4 100644
--- a/gst/gstparse.c
+++ b/gst/gstparse.c
@@ -314,6 +314,7 @@ gst_parse_launch_full (const gchar * pipeline_description,
{
#ifndef GST_DISABLE_PARSE
GstElement *element;
+ GError *myerror = NULL;
g_return_val_if_fail (pipeline_description != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
@@ -321,16 +322,20 @@ gst_parse_launch_full (const gchar * pipeline_description,
GST_CAT_INFO (GST_CAT_PIPELINE, "parsing pipeline description '%s'",
pipeline_description);
- element = priv_gst_parse_launch (pipeline_description, error, context, flags);
+ element = priv_gst_parse_launch (pipeline_description, &myerror, context,
+ flags);
/* don't return partially constructed pipeline if FATAL_ERRORS was given */
- if (G_UNLIKELY (error != NULL && *error != NULL && element != NULL)) {
+ if (G_UNLIKELY (myerror != NULL && element != NULL)) {
if ((flags & GST_PARSE_FLAG_FATAL_ERRORS)) {
gst_object_unref (element);
element = NULL;
}
}
+ if (myerror)
+ g_propagate_error (error, myerror);
+
return element;
#else
gchar *msg;
diff --git a/tests/check/pipelines/parse-launch.c b/tests/check/pipelines/parse-launch.c
index 8db1d6b50..fe292dfcb 100644
--- a/tests/check/pipelines/parse-launch.c
+++ b/tests/check/pipelines/parse-launch.c
@@ -651,6 +651,11 @@ GST_START_TEST (test_flags)
fail_unless (element == NULL, "expected NULL return with FATAL_ERRORS");
g_error_free (err);
err = NULL;
+
+ /* test GST_PARSE_FLAG_FATAL_ERRORS without GError */
+ element = gst_parse_launch_full ("fakesrc ! coffeesink", NULL,
+ GST_PARSE_FLAG_FATAL_ERRORS, NULL);
+ fail_unless (element == NULL, "expected NULL return with FATAL_ERRORS");
}
GST_END_TEST;