mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-02 16:52:42 +00:00
parse: Make the FATAL_ERRORS flag also work without a GError
Also add a unit tests
This commit is contained in:
parent
a0e2eb6169
commit
789eda5a37
2 changed files with 12 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue