diff options
author | Tim-Philipp Müller <tim@centricular.net> | 2013-04-21 17:24:55 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2013-04-21 17:30:58 +0100 |
commit | 830926e47da5f59d84be171ef4c307a580a948a5 (patch) | |
tree | 25f551558f108aff63cf82975da52ce29aa1b554 | |
parent | fbe80a688d115abc06a3a40c225089857fef5151 (diff) |
uridecodebin: don't report 'no uri handler found' if the URI was rejected by a source
If a source element could be created for a URI, but all elements rejected
the URI for some reason, propagate the error from the URI handler instead
of reporting a 'no uri handler found for protocol xyz' error, which is
confusing. Fixes error reporting with dvb:// URIs when the channel config
file could not be found or not be parsed or the channel isn't listed.
https://bugzilla.gnome.org/show_bug.cgi?id=678892
-rw-r--r-- | gst/playback/gsturidecodebin.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c index 34468dc16..9997241c3 100644 --- a/gst/playback/gsturidecodebin.c +++ b/gst/playback/gsturidecodebin.c @@ -1255,6 +1255,7 @@ gen_source_element (GstURIDecodeBin * decoder) GParamSpec *pspec; GstQuery *query; GstSchedulingFlags flags; + GError *err = NULL; if (!decoder->uri) goto no_uri; @@ -1268,7 +1269,7 @@ gen_source_element (GstURIDecodeBin * decoder) goto uri_blacklisted; source = - gst_element_make_from_uri (GST_URI_SRC, decoder->uri, "source", NULL); + gst_element_make_from_uri (GST_URI_SRC, decoder->uri, "source", &err); if (!source) goto no_source; @@ -1357,6 +1358,7 @@ invalid_uri: { GST_ELEMENT_ERROR (decoder, RESOURCE, NOT_FOUND, (_("Invalid URI \"%s\"."), decoder->uri), (NULL)); + g_clear_error (&err); return NULL; } uri_blacklisted: @@ -1367,23 +1369,29 @@ uri_blacklisted: } no_source: { - gchar *prot = gst_uri_get_protocol (decoder->uri); - /* whoops, could not create the source element, dig a little deeper to * figure out what might be wrong. */ - if (prot) { - GstMessage *msg; + if (err != NULL && err->code == GST_URI_ERROR_UNSUPPORTED_PROTOCOL) { + gchar *prot; + + prot = gst_uri_get_protocol (decoder->uri); + if (prot == NULL) + goto invalid_uri; - msg = - gst_missing_uri_source_message_new (GST_ELEMENT_CAST (decoder), prot); - gst_element_post_message (GST_ELEMENT_CAST (decoder), msg); + gst_element_post_message (GST_ELEMENT_CAST (decoder), + gst_missing_uri_source_message_new (GST_ELEMENT (decoder), prot)); GST_ELEMENT_ERROR (decoder, CORE, MISSING_PLUGIN, (_("No URI handler implemented for \"%s\"."), prot), (NULL)); + g_free (prot); - } else - goto invalid_uri; + } else { + GST_ELEMENT_ERROR (decoder, RESOURCE, NOT_FOUND, + ("%s", (err) ? err->message : "URI was not accepted by any element"), + ("No element accepted URI '%s'", decoder->uri)); + } + g_clear_error (&err); return NULL; } } |