seek: use gst_filename_to_uri() to convert a filename to a uri
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Wed, 25 May 2011 17:45:33 +0000 (18:45 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Wed, 25 May 2011 18:25:34 +0000 (19:25 +0100)
tests/examples/seek/seek.c

index 34d8a3b..ef3fce4 100644 (file)
@@ -931,11 +931,13 @@ playerbin_set_uri (GstElement * player, const gchar * location)
   gchar *uri;
 
   /* Add "file://" prefix for convenience */
-  if (g_str_has_prefix (location, "/")) {
-    uri = g_strconcat ("file://", location, NULL);
+  if (g_str_has_prefix (location, "/") || !gst_uri_is_valid (location)) {
+    uri = gst_filename_to_uri (location, NULL);
+    g_print ("Setting URI: %s\n", uri);
     g_object_set (G_OBJECT (player), "uri", uri, NULL);
     g_free (uri);
   } else {
+    g_print ("Setting URI: %s\n", location);
     g_object_set (G_OBJECT (player), "uri", location, NULL);
   }
 }