GNOME Bugzilla – Bug 313322
[PATCH] filesrc doesn't handle file:// URIs
Last modified: 2006-01-16 12:43:35 UTC
filesrc advertises itself as understanding the file:// protocol through the registry. However, it assumes location to be a path and prepends file:// even if it has a file:// prefix already. The patch I'm going to attach fixes that so that code like the following will work: /* ... */ uri = "file:///home/r/test.ogg" source = gst_element_make_from_uri (GST_URI_SRC, uri, "source"); /* ... */ g_object_set (G_OBJECT (source), "location", uri, NULL); /* ... */
Created attachment 50617 [details] [review] filesrc-uri.patch Patch against current BRANCH-GSTREAMER-0_8 to make filesrc handle file:// URIs properly.
You should be able to set file:// URIs on filesrc with gst_uri_handler_set_uri (GST_URI_HANDLER (filersrc), uri); Cheers -Tim
The format of the location property of filesrc can't be changed now, we're in a stable series. Tim's comment should be sufficient info.
I'm not exactly sure why this would change the format of the location property. It simply prevents nonsense like src->uri = "file://file://..." from happening, which seems rather unlikely to be desirable. The standard code path, where location doesn't start with "file://" isn't touched by the patch. As far as setting the URI manually is concerned, that doesn't solve the problem. filesrc advertizes itself as understanding "file://" URIs via the plugin registry, so either that or the code is clearly buggy. The plan behind this patch is to allow GStreamer based applications to be able to load files with only the filesrc plugin and no gnomevfs plugin installed which is a bit on the heavy side dependecy-wise and therefore not an option for handheld devices etc. It's all about making stuff like this (or any other application) work with filesrc: $ gst-launch file://foo.ogg ! decodebin ! esdsink
gst-launch file://foo.ogg ! decodebin ! esdsink should already work (and does here), minus a missing audioconvert ! audioscale at least. Also, playbin should pick filesrc for file:// URIs in current 0.8, as filesrc has a rank of PRIMARY and gnomevfssrc a rank of SECONDAY. There's also a utility function to create an element given a URI, which should return filesrc as well. (Not that I can see much harm in checking for a file:// prefix, but I don't see why it should be necessary for what you want to achieve)