From ce4da7c6612fc22668543f919ff4bcce9a22adc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 27 Apr 2007 07:27:36 +0000 Subject: [PATCH] plugins/elements/: Special case the "file://" URI as as this is used by some applications to test with gst_element_ma... Original commit message from CVS: * plugins/elements/gstfilesink.c: (gst_file_sink_uri_set_uri): * plugins/elements/gstfilesrc.c: (gst_file_src_uri_set_uri): Special case the "file://" URI as as this is used by some applications to test with gst_element_make_from_uri if there's an element that supports the URI protocol. Also move the g_path_is_absolute() check for the location part of the URI to also check this for "file://localhost/bla" URIs. --- ChangeLog | 10 ++++++++++ plugins/elements/gstfilesink.c | 18 ++++++++++++------ plugins/elements/gstfilesrc.c | 18 ++++++++++++------ 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0412667f28..27d6dd77f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-04-27 Sebastian Dröge + + * plugins/elements/gstfilesink.c: (gst_file_sink_uri_set_uri): + * plugins/elements/gstfilesrc.c: (gst_file_src_uri_set_uri): + Special case the "file://" URI as as this is used by some + applications to test with gst_element_make_from_uri if there's + an element that supports the URI protocol. + Also move the g_path_is_absolute() check for the location part + of the URI to also check this for "file://localhost/bla" URIs. + 2007-04-26 Tim-Philipp Müller * docs/gst/gstreamer-sections.txt: diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c index 09c3be6a27..47650ac8ec 100644 --- a/plugins/elements/gstfilesink.c +++ b/plugins/elements/gstfilesink.c @@ -554,14 +554,20 @@ gst_file_sink_uri_set_uri (GstURIHandler * handler, const gchar * uri) * "location" with uri + 16 because it provides unescaping */ location = gst_uri_get_location (tmp); g_free (tmp); + } else if (strcmp (uri, "file://") == 0) { + /* Special case for "file://" as this is used by some applications + * to test with gst_element_make_from_uri if there's an element + * that supports the URI protocol. */ + return TRUE; } else { location = gst_uri_get_location (uri); - if (!location) - return FALSE; - if (!g_path_is_absolute (location)) { - g_free (location); - return FALSE; - } + } + + if (!location) + return FALSE; + if (!g_path_is_absolute (location)) { + g_free (location); + return FALSE; } ret = gst_file_sink_set_location (sink, location); diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index 2300bc120c..b386462ec7 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -1074,14 +1074,20 @@ gst_file_src_uri_set_uri (GstURIHandler * handler, const gchar * uri) * "location" with uri + 16 because it provides unescaping */ location = gst_uri_get_location (tmp); g_free (tmp); + } else if (strcmp (uri, "file://") == 0) { + /* Special case for "file://" as this is used by some applications + * to test with gst_element_make_from_uri if there's an element + * that supports the URI protocol. */ + return TRUE; } else { location = gst_uri_get_location (uri); - if (!location) - return FALSE; - if (!g_path_is_absolute (location)) { - g_free (location); - return FALSE; - } + } + + if (!location) + return FALSE; + if (!g_path_is_absolute (location)) { + g_free (location); + return FALSE; } ret = gst_file_src_set_location (src, location);