2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
4 * Copyright (C) 2011 Tim-Philipp Müller <tim centricular net>
6 * gsturi.c: register URI handlers
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
25 * SECTION:gsturihandler
26 * @short_description: Interface to ease URI handling in plugins.
28 * The URIHandler is an interface that is implemented by Source and Sink
29 * #GstElement to simplify then handling of URI.
31 * An application can use the following functions to quickly get an element
32 * that handles the given URI for reading or writing
33 * (gst_element_make_from_uri()).
35 * Source and Sink plugins should implement this interface when possible.
37 * Last reviewed on 2005-11-09 (0.9.4)
44 #include "gst_private.h"
48 #include "gstregistry.h"
50 #include "gst-i18n-lib.h"
54 GST_DEBUG_CATEGORY_STATIC (gst_uri_handler_debug);
55 #define GST_CAT_DEFAULT gst_uri_handler_debug
58 gst_uri_handler_get_type (void)
60 static volatile gsize urihandler_type = 0;
62 if (g_once_init_enter (&urihandler_type)) {
64 static const GTypeInfo urihandler_info = {
65 sizeof (GstURIHandlerInterface),
77 _type = g_type_register_static (G_TYPE_INTERFACE,
78 "GstURIHandler", &urihandler_info, 0);
80 GST_DEBUG_CATEGORY_INIT (gst_uri_handler_debug, "GST_URI", GST_DEBUG_BOLD,
82 g_once_init_leave (&urihandler_type, _type);
84 return urihandler_type;
88 gst_uri_error_quark (void)
90 return g_quark_from_static_string ("gst-uri-error-quark");
93 static const guchar acceptable[96] = { /* X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */
94 0x00, 0x3F, 0x20, 0x20, 0x20, 0x00, 0x2C, 0x3F, 0x3F, 0x3F, 0x3F, 0x22, 0x20, 0x3F, 0x3F, 0x1C, /* 2X !"#$%&'()*+,-./ */
95 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x38, 0x20, 0x20, 0x2C, 0x20, 0x2C, /* 3X 0123456789:;<=>? */
96 0x30, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, /* 4X @ABCDEFGHIJKLMNO */
97 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x20, 0x20, 0x20, 0x20, 0x3F, /* 5X PQRSTUVWXYZ[\]^_ */
98 0x20, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, /* 6X `abcdefghijklmno */
99 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x20, 0x20, 0x20, 0x3F, 0x20 /* 7X pqrstuvwxyz{|}~DEL */
104 UNSAFE_ALL = 0x1, /* Escape all unsafe characters */
105 UNSAFE_ALLOW_PLUS = 0x2, /* Allows '+' */
106 UNSAFE_PATH = 0x4, /* Allows '/' and '?' and '&' and '=' */
107 UNSAFE_DOS_PATH = 0x8, /* Allows '/' and '?' and '&' and '=' and ':' */
108 UNSAFE_HOST = 0x10, /* Allows '/' and ':' and '@' */
109 UNSAFE_SLASHES = 0x20 /* Allows all characters except for '/' and '%' */
110 } UnsafeCharacterSet;
112 #define HEX_ESCAPE '%'
114 /* Escape undesirable characters using %
115 * -------------------------------------
117 * This function takes a pointer to a string in which
118 * some characters may be unacceptable unescaped.
119 * It returns a string which has these characters
120 * represented by a '%' character followed by two hex digits.
122 * This routine returns a g_malloced string.
125 static const gchar hex[16] = "0123456789ABCDEF";
128 escape_string_internal (const gchar * string, UnsafeCharacterSet mask)
130 #define ACCEPTABLE_CHAR(a) ((a)>=32 && (a)<128 && (acceptable[(a)-32] & use_mask))
137 UnsafeCharacterSet use_mask;
139 g_return_val_if_fail (mask == UNSAFE_ALL
140 || mask == UNSAFE_ALLOW_PLUS
141 || mask == UNSAFE_PATH
142 || mask == UNSAFE_DOS_PATH
143 || mask == UNSAFE_HOST || mask == UNSAFE_SLASHES, NULL);
145 if (string == NULL) {
151 for (p = string; *p != '\0'; p++) {
153 if (!ACCEPTABLE_CHAR (c)) {
156 if ((use_mask == UNSAFE_HOST) && (unacceptable || (c == '/'))) {
157 /* when escaping a host, if we hit something that needs to be escaped, or we finally
158 * hit a path separator, revert to path mode (the host segment of the url is over).
160 use_mask = UNSAFE_PATH;
164 result = g_malloc (p - string + unacceptable * 2 + 1);
167 for (q = result, p = string; *p != '\0'; p++) {
170 if (!ACCEPTABLE_CHAR (c)) {
171 *q++ = HEX_ESCAPE; /* means hex coming */
177 if ((use_mask == UNSAFE_HOST) && (!ACCEPTABLE_CHAR (c) || (c == '/'))) {
178 use_mask = UNSAFE_PATH;
188 * @string: string to be escaped
190 * Escapes @string, replacing any and all special characters
191 * with equivalent escape sequences.
193 * Return value: a newly allocated string equivalent to @string
194 * but with all special characters escaped
197 escape_string (const gchar * string)
199 return escape_string_internal (string, UNSAFE_ALL);
205 return c >= '0' && c <= '9' ? c - '0'
206 : c >= 'A' && c <= 'F' ? c - 'A' + 10
207 : c >= 'a' && c <= 'f' ? c - 'a' + 10 : -1;
211 unescape_character (const char *scanner)
216 first_digit = hex_to_int (*scanner++);
217 if (first_digit < 0) {
221 second_digit = hex_to_int (*scanner);
222 if (second_digit < 0) {
226 return (first_digit << 4) | second_digit;
230 * @escaped_string: an escaped URI, path, or other string
231 * @illegal_characters: a string containing a sequence of characters
232 * considered "illegal", '\0' is automatically in this list.
234 * Decodes escaped characters (i.e. PERCENTxx sequences) in @escaped_string.
235 * Characters are encoded in PERCENTxy form, where xy is the ASCII hex code
236 * for character 16x+y.
238 * Return value: a newly allocated string with the unescaped equivalents,
239 * or %NULL if @escaped_string contained one of the characters
240 * in @illegal_characters.
243 unescape_string (const gchar * escaped_string, const gchar * illegal_characters)
249 if (escaped_string == NULL) {
253 result = g_malloc (strlen (escaped_string) + 1);
256 for (in = escaped_string; *in != '\0'; in++) {
258 if (*in == HEX_ESCAPE) {
259 character = unescape_character (in + 1);
261 /* Check for an illegal character. We consider '\0' illegal here. */
263 || (illegal_characters != NULL
264 && strchr (illegal_characters, (char) character) != NULL)) {
270 *out++ = (char) character;
274 g_assert ((gsize) (out - result) <= strlen (escaped_string));
281 gst_uri_protocol_check_internal (const gchar * uri, gchar ** endptr)
283 gchar *check = (gchar *) uri;
285 g_assert (uri != NULL);
286 g_assert (endptr != NULL);
288 if (g_ascii_isalpha (*check)) {
290 while (g_ascii_isalnum (*check) || *check == '+'
291 || *check == '-' || *check == '.')
299 * gst_uri_protocol_is_valid:
300 * @protocol: A string
302 * Tests if the given string is a valid protocol identifier. Protocols
303 * must consist of alphanumeric characters, '+', '-' and '.' and must
304 * start with a alphabetic character. See RFC 3986 Section 3.1.
306 * Returns: TRUE if the string is a valid protocol identifier, FALSE otherwise.
309 gst_uri_protocol_is_valid (const gchar * protocol)
313 g_return_val_if_fail (protocol != NULL, FALSE);
315 gst_uri_protocol_check_internal (protocol, &endptr);
317 return *endptr == '\0' && ((gsize) (endptr - protocol)) >= 3;
324 * Tests if the given string is a valid URI identifier. URIs start with a valid
325 * scheme followed by ":" and maybe a string identifying the location.
327 * Returns: TRUE if the string is a valid URI
330 gst_uri_is_valid (const gchar * uri)
334 g_return_val_if_fail (uri != NULL, FALSE);
336 gst_uri_protocol_check_internal (uri, &endptr);
338 return *endptr == ':' && ((gsize) (endptr - uri)) >= 3;
342 * gst_uri_get_protocol:
345 * Extracts the protocol out of a given valid URI. The returned string must be
346 * freed using g_free().
348 * Returns: The protocol for this URI.
351 gst_uri_get_protocol (const gchar * uri)
355 g_return_val_if_fail (uri != NULL, NULL);
356 g_return_val_if_fail (gst_uri_is_valid (uri), NULL);
358 colon = strstr (uri, ":");
360 return g_ascii_strdown (uri, colon - uri);
364 * gst_uri_has_protocol:
366 * @protocol: a protocol string (e.g. "http")
368 * Checks if the protocol of a given valid URI matches @protocol.
370 * Returns: %TRUE if the protocol matches.
375 gst_uri_has_protocol (const gchar * uri, const gchar * protocol)
379 g_return_val_if_fail (uri != NULL, FALSE);
380 g_return_val_if_fail (protocol != NULL, FALSE);
381 g_return_val_if_fail (gst_uri_is_valid (uri), FALSE);
383 colon = strstr (uri, ":");
388 return (g_ascii_strncasecmp (uri, protocol, (gsize) (colon - uri)) == 0);
392 * gst_uri_get_location:
395 * Extracts the location out of a given valid URI, ie. the protocol and "://"
396 * are stripped from the URI, which means that the location returned includes
397 * the hostname if one is specified. The returned string must be freed using
400 * Free-function: g_free
402 * Returns: (transfer full) (array zero-terminated=1): the location for this
403 * URI. Returns NULL if the URI isn't valid. If the URI does not contain
404 * a location, an empty string is returned.
407 gst_uri_get_location (const gchar * uri)
410 gchar *unescaped = NULL;
412 g_return_val_if_fail (uri != NULL, NULL);
413 g_return_val_if_fail (gst_uri_is_valid (uri), NULL);
415 colon = strstr (uri, "://");
419 unescaped = unescape_string (colon + 3, "/");
421 /* On Windows an URI might look like file:///c:/foo/bar.txt or
422 * file:///c|/foo/bar.txt (some Netscape versions) and we want to
423 * return c:/foo/bar.txt as location rather than /c:/foo/bar.txt.
424 * Can't use g_filename_from_uri() here because it will only handle the
425 * file:// protocol */
427 if (unescaped != NULL && unescaped[0] == '/' &&
428 g_ascii_isalpha (unescaped[1]) &&
429 (unescaped[2] == ':' || unescaped[2] == '|')) {
431 g_memmove (unescaped, unescaped + 1, strlen (unescaped + 1) + 1);
435 GST_LOG ("extracted location '%s' from URI '%s'", GST_STR_NULL (unescaped),
442 * @protocol: Protocol for URI
443 * @location: (array zero-terminated=1) (transfer none): Location for URI
445 * Constructs a URI for a given valid protocol and location.
447 * Free-function: g_free
449 * Returns: (transfer full) (array zero-terminated=1): a new string for this
450 * URI. Returns NULL if the given URI protocol is not valid, or the given
454 gst_uri_construct (const gchar * protocol, const gchar * location)
456 char *escaped, *proto_lowercase;
459 g_return_val_if_fail (gst_uri_protocol_is_valid (protocol), NULL);
460 g_return_val_if_fail (location != NULL, NULL);
462 proto_lowercase = g_ascii_strdown (protocol, -1);
463 escaped = escape_string (location);
464 retval = g_strdup_printf ("%s://%s", proto_lowercase, escaped);
466 g_free (proto_lowercase);
474 const gchar *protocol;
479 search_by_entry (GstPluginFeature * feature, gpointer search_entry)
481 const gchar *const *protocols;
482 GstElementFactory *factory;
483 SearchEntry *entry = (SearchEntry *) search_entry;
485 if (!GST_IS_ELEMENT_FACTORY (feature))
487 factory = GST_ELEMENT_FACTORY_CAST (feature);
489 if (factory->uri_type != entry->type)
492 protocols = gst_element_factory_get_uri_protocols (factory);
494 if (protocols == NULL) {
495 g_warning ("Factory '%s' implements GstUriHandler interface but returned "
496 "no supported protocols!", gst_plugin_feature_get_name (feature));
500 while (*protocols != NULL) {
501 if (g_ascii_strcasecmp (*protocols, entry->protocol) == 0)
509 sort_by_rank (GstPluginFeature * first, GstPluginFeature * second)
511 return gst_plugin_feature_get_rank (second) -
512 gst_plugin_feature_get_rank (first);
516 get_element_factories_from_uri_protocol (const GstURIType type,
517 const gchar * protocol)
519 GList *possibilities;
522 g_return_val_if_fail (protocol, NULL);
525 entry.protocol = protocol;
526 possibilities = gst_registry_feature_filter (gst_registry_get (),
527 search_by_entry, FALSE, &entry);
529 return possibilities;
533 * gst_uri_protocol_is_supported:
534 * @type: Whether to check for a source or a sink
535 * @protocol: Protocol that should be checked for (e.g. "http" or "smb")
537 * Checks if an element exists that supports the given URI protocol. Note
538 * that a positive return value does not imply that a subsequent call to
539 * gst_element_make_from_uri() is guaranteed to work.
546 gst_uri_protocol_is_supported (const GstURIType type, const gchar * protocol)
548 GList *possibilities;
550 g_return_val_if_fail (protocol, FALSE);
552 possibilities = get_element_factories_from_uri_protocol (type, protocol);
555 g_list_free (possibilities);
562 * gst_element_make_from_uri:
563 * @type: Whether to create a source or a sink
564 * @uri: URI to create an element for
565 * @elementname: (allow-none): Name of created element, can be NULL.
566 * @error: (allow-none): address where to store error information, or NULL.
568 * Creates an element for handling the given URI.
570 * Returns: (transfer full): a new element or NULL if none could be created
573 gst_element_make_from_uri (const GstURIType type, const gchar * uri,
574 const gchar * elementname, GError ** error)
576 GList *possibilities, *walk;
578 GstElement *ret = NULL;
580 g_return_val_if_fail (gst_is_initialized (), NULL);
581 g_return_val_if_fail (GST_URI_TYPE_IS_VALID (type), NULL);
582 g_return_val_if_fail (gst_uri_is_valid (uri), NULL);
583 g_return_val_if_fail (error == NULL || *error == NULL, NULL);
585 GST_DEBUG ("type:%d, uri:%s, elementname:%s", type, uri, elementname);
587 protocol = gst_uri_get_protocol (uri);
588 possibilities = get_element_factories_from_uri_protocol (type, protocol);
590 if (!possibilities) {
591 GST_DEBUG ("No %s for URI '%s'", type == GST_URI_SINK ? "sink" : "source",
593 /* The error message isn't great, but we don't expect applications to
594 * show that error to users, but call the missing plugins functions */
595 g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_UNSUPPORTED_PROTOCOL,
596 _("No URI handler for the %s protocol found"), protocol);
602 possibilities = g_list_sort (possibilities, (GCompareFunc) sort_by_rank);
603 walk = possibilities;
605 GstElementFactory *factory = walk->data;
606 GError *uri_err = NULL;
608 ret = gst_element_factory_create (factory, elementname);
610 GstURIHandler *handler = GST_URI_HANDLER (ret);
612 if (gst_uri_handler_set_uri (handler, uri, &uri_err))
615 GST_WARNING ("%s didn't accept URI '%s': %s", GST_OBJECT_NAME (ret), uri,
618 if (error != NULL && *error == NULL)
619 g_propagate_error (error, uri_err);
621 g_error_free (uri_err);
623 gst_object_unref (ret);
628 gst_plugin_feature_list_free (possibilities);
630 GST_LOG_OBJECT (ret, "created %s for URL '%s'",
631 type == GST_URI_SINK ? "sink" : "source", uri);
633 /* if the first handler didn't work, but we found another one that works */
635 g_clear_error (error);
641 * gst_uri_handler_get_uri_type:
642 * @handler: A #GstURIHandler.
644 * Gets the type of the given URI handler
646 * Returns: the #GstURIType of the URI handler.
647 * Returns #GST_URI_UNKNOWN if the @handler isn't implemented correctly.
650 gst_uri_handler_get_uri_type (GstURIHandler * handler)
652 GstURIHandlerInterface *iface;
655 g_return_val_if_fail (GST_IS_URI_HANDLER (handler), GST_URI_UNKNOWN);
657 iface = GST_URI_HANDLER_GET_INTERFACE (handler);
658 g_return_val_if_fail (iface != NULL, GST_URI_UNKNOWN);
659 g_return_val_if_fail (iface->get_type != NULL, GST_URI_UNKNOWN);
661 ret = iface->get_type (G_OBJECT_TYPE (handler));
662 g_return_val_if_fail (GST_URI_TYPE_IS_VALID (ret), GST_URI_UNKNOWN);
668 * gst_uri_handler_get_protocols:
669 * @handler: A #GstURIHandler.
671 * Gets the list of protocols supported by @handler. This list may not be
674 * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): the
675 * supported protocols. Returns NULL if the @handler isn't implemented
676 * properly, or the @handler doesn't support any protocols.
679 gst_uri_handler_get_protocols (GstURIHandler * handler)
681 GstURIHandlerInterface *iface;
682 const gchar *const *ret;
684 g_return_val_if_fail (GST_IS_URI_HANDLER (handler), NULL);
686 iface = GST_URI_HANDLER_GET_INTERFACE (handler);
687 g_return_val_if_fail (iface != NULL, NULL);
688 g_return_val_if_fail (iface->get_protocols != NULL, NULL);
690 ret = iface->get_protocols (G_OBJECT_TYPE (handler));
691 g_return_val_if_fail (ret != NULL, NULL);
697 * gst_uri_handler_get_uri:
698 * @handler: A #GstURIHandler
700 * Gets the currently handled URI.
702 * Returns: (transfer full): the URI currently handled by the @handler.
703 * Returns NULL if there are no URI currently handled. The
704 * returned string must be freed with g_free() when no longer needed.
707 gst_uri_handler_get_uri (GstURIHandler * handler)
709 GstURIHandlerInterface *iface;
712 g_return_val_if_fail (GST_IS_URI_HANDLER (handler), NULL);
714 iface = GST_URI_HANDLER_GET_INTERFACE (handler);
715 g_return_val_if_fail (iface != NULL, NULL);
716 g_return_val_if_fail (iface->get_uri != NULL, NULL);
717 ret = iface->get_uri (handler);
719 g_return_val_if_fail (gst_uri_is_valid (ret), NULL);
725 * gst_uri_handler_set_uri:
726 * @handler: A #GstURIHandler
728 * @error: (allow-none): address where to store a #GError in case of
731 * Tries to set the URI of the given handler.
733 * Returns: TRUE if the URI was set successfully, else FALSE.
736 gst_uri_handler_set_uri (GstURIHandler * handler, const gchar * uri,
739 GstURIHandlerInterface *iface;
741 gchar *new_uri, *protocol, *location, *colon;
743 g_return_val_if_fail (GST_IS_URI_HANDLER (handler), FALSE);
744 g_return_val_if_fail (gst_uri_is_valid (uri), FALSE);
745 g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
747 iface = GST_URI_HANDLER_GET_INTERFACE (handler);
748 g_return_val_if_fail (iface != NULL, FALSE);
749 g_return_val_if_fail (iface->set_uri != NULL, FALSE);
751 protocol = gst_uri_get_protocol (uri);
753 if (iface->get_protocols) {
754 const gchar *const *protocols;
755 const gchar *const *p;
756 gboolean found_protocol = FALSE;
758 protocols = iface->get_protocols (G_OBJECT_TYPE (handler));
759 if (protocols != NULL) {
760 for (p = protocols; *p != NULL; ++p) {
761 if (g_ascii_strcasecmp (protocol, *p) == 0) {
762 found_protocol = TRUE;
767 if (!found_protocol) {
768 g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_UNSUPPORTED_PROTOCOL,
769 _("URI scheme '%s' not supported"), protocol);
776 colon = strstr (uri, ":");
777 location = g_strdup (colon);
779 new_uri = g_strdup_printf ("%s%s", protocol, location);
781 ret = iface->set_uri (handler, uri, error);
791 gst_file_utils_canonicalise_path (const gchar * path)
793 gchar **parts, **p, *clean_path;
797 GST_WARNING ("FIXME: canonicalise win32 path");
798 return g_strdup (path);
802 parts = g_strsplit (path, "/", -1);
806 if (strcmp (*p, ".") == 0) {
807 /* just move all following parts on top of this, incl. NUL terminator */
809 g_memmove (p, p + 1, (g_strv_length (p + 1) + 1) * sizeof (gchar *));
810 /* re-check the new current part again in the next iteration */
812 } else if (strcmp (*p, "..") == 0 && p > parts) {
813 /* just move all following parts on top of the previous part, incl.
817 g_memmove (p - 1, p + 1, (g_strv_length (p + 1) + 1) * sizeof (gchar *));
818 /* re-check the new current part again in the next iteration */
827 num_parts = g_strv_length (parts) + 1; /* incl. terminator */
828 parts = g_renew (gchar *, parts, num_parts + 1);
829 g_memmove (parts + 1, parts, num_parts * sizeof (gchar *));
830 parts[0] = g_strdup ("/");
833 clean_path = g_build_filenamev (parts);
839 file_path_contains_relatives (const gchar * path)
841 return (strstr (path, "/./") != NULL || strstr (path, "/../") != NULL ||
842 strstr (path, G_DIR_SEPARATOR_S "." G_DIR_SEPARATOR_S) != NULL ||
843 strstr (path, G_DIR_SEPARATOR_S ".." G_DIR_SEPARATOR_S) != NULL);
847 * gst_filename_to_uri:
848 * @filename: absolute or relative file name path
849 * @error: pointer to error, or NULL
851 * Similar to g_filename_to_uri(), but attempts to handle relative file paths
852 * as well. Before converting @filename into an URI, it will be prefixed by
853 * the current working directory if it is a relative path, and then the path
854 * will be canonicalised so that it doesn't contain any './' or '../' segments.
856 * On Windows #filename should be in UTF-8 encoding.
861 gst_filename_to_uri (const gchar * filename, GError ** error)
863 gchar *abs_location = NULL;
864 gchar *uri, *abs_clean;
866 g_return_val_if_fail (filename != NULL, NULL);
867 g_return_val_if_fail (error == NULL || *error == NULL, NULL);
869 if (g_path_is_absolute (filename)) {
870 if (!file_path_contains_relatives (filename)) {
871 uri = g_filename_to_uri (filename, NULL, error);
875 abs_location = g_strdup (filename);
879 cwd = g_get_current_dir ();
880 abs_location = g_build_filename (cwd, filename, NULL);
883 if (!file_path_contains_relatives (abs_location)) {
884 uri = g_filename_to_uri (abs_location, NULL, error);
889 /* path is now absolute, but contains '.' or '..' */
890 abs_clean = gst_file_utils_canonicalise_path (abs_location);
891 GST_LOG ("'%s' -> '%s' -> '%s'", filename, abs_location, abs_clean);
892 uri = g_filename_to_uri (abs_clean, NULL, error);
897 g_free (abs_location);
898 GST_DEBUG ("'%s' -> '%s'", filename, uri);