After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 403172 - [filesrc] doesn't handle localhost file locations
[filesrc] doesn't handle localhost file locations
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.10.x
Other Linux
: Normal normal
: 0.10.12
Assigned To: Sebastian Dröge (slomo)
GStreamer Maintainers
Depends on:
Blocks: 403174
 
 
Reported: 2007-02-01 11:31 UTC by Bastien Nocera
Modified: 2007-02-02 10:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
file-localhost.diff (1.88 KB, patch)
2007-02-01 20:21 UTC, Sebastian Dröge (slomo)
none Details | Review
file-localhost.diff (2.34 KB, patch)
2007-02-01 20:43 UTC, Sebastian Dröge (slomo)
committed Details | Review

Description Bastien Nocera 2007-02-01 11:31:30 UTC
$ gst-launch gnomevfssrc location=file://localhost/home/bnocera/Music/file.mp3 !
fakesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 729841000 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
FREEING pipeline ...

$ gst-launch playbin uri=file://localhost/home/bnocera/Music/file.mp3
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /playbin0/source: Resource not found.
Additional debug info:
gstfilesrc.c(975): gst_file_src_start (): /playbin0/source:
No such file "localhost/home/bnocera/Music/file.mp3"
Setting pipeline to NULL ...
FREEING pipeline ...


gstreamer-plugins-fluendo-windowsmedia-0.10-7.el5
gstreamer-plugins-good-0.10.4-1.fc6
gstreamer-plugins-good-devel-0.10.4-1.fc6
gstreamer-0.10.10-2.fc6
gstreamer-plugins-base-devel-0.10.10-1.fc6
gstreamer-plugins-fluendo-video-0.10-7.el5
gstreamer-tools-0.10.10-2.fc6
gstreamer-plugins-base-0.10.10-1.fc6
gstreamer-ffmpeg-0.10.2-0.3.20061108.lvn6
gstreamer-plugins-ugly-0.10.4-3.lvn6
gstreamer-plugins-fluendo-mp3-0.10-7.el5
gstreamer-plugins-base-0.10.9-4
gstreamer-devel-0.10.10-2.fc6
Comment 1 Tim-Philipp Müller 2007-02-01 11:56:22 UTC
Sigh, is this really needed?

Next thing we need to support file://myhostname/foo/bar.ogg and file://myipaddress/foo/bar.ogg etc.

Comment 2 Sebastian Dröge (slomo) 2007-02-01 12:33:11 UTC
It seems that gnomevfs-ls for example just strips everything between the second and third slash. Maybe we should just do the same for file:// URIs or just fail for everything else. RFC1738[1] seems to require support for the hostname part of file:// URIs...

Shouldn't be that hard to implement unless we want to support myhostname and myipaddress and similar stuff as this would require some special magic to determine whether it belongs to this machine or something else.

[1] http://www.rfc-editor.org/rfc/rfc1738.txt
Comment 3 Bastien Nocera 2007-02-01 13:32:46 UTC
(In reply to comment #1)
> Sigh, is this really needed?

file://localhost/blah should work...

> Next thing we need to support file://myhostname/foo/bar.ogg and
> file://myipaddress/foo/bar.ogg etc.

Let me know how you think this would work ;)

Just special-casing file://localhost/ should be fine.
Comment 4 Sebastian Dröge (slomo) 2007-02-01 14:34:46 UTC
Tim, what do you think? If you're fine with this I'll make a patch later to special-case file://localhost/ and just create a more meaningfull error if another hostname/ip is supplied.
Comment 5 Tim-Philipp Müller 2007-02-01 16:34:01 UTC
> > Next thing we need to support file://myhostname/foo/bar.ogg and
> > file://myipaddress/foo/bar.ogg etc.
> 
> Let me know how you think this would work ;)

gnomevfs-info appears to accept file://myhostname/foo/bar.ogg ;)


 
> Just special-casing file://localhost/ should be fine.

Fine with me.


> (...) I'll make a patch later to special-case file://localhost/
> and just create a more meaningfull error if another hostname/ip
> is supplied.

Cool.

Could we just do the following:

 - skip 'localhost' prefix in _set_uri()

 - otherwise, return FALSE in _set_uri() if the URI
   bit after protocol:// doesn't start with a '/'

?

Comment 6 Sebastian Dröge (slomo) 2007-02-01 17:29:12 UTC
gnomevfs-info accepts file://blablabla/foo/bar but it just strips the hostname part... i.e. every hostname is localhost. That would be another possibility but I would prefer the one you outlined, i.e. to just not accept anything else than localhost or no hostname.

The gnomevfs behaviour is IMHO not compliant with the RFC.
Comment 7 Sebastian Dröge (slomo) 2007-02-01 20:21:24 UTC
Created attachment 81694 [details] [review]
file-localhost.diff

ok, here is it. works fine for me and if file://foobar/blabla is specified as URL gnomevfssrc is chosen as source (if installed) and handles it just fine (although the gnomevfs behaviour is arguably wrong)
Comment 8 Sebastian Dröge (slomo) 2007-02-01 20:43:34 UTC
Created attachment 81700 [details] [review]
file-localhost.diff

Instead of taking the (unescaped!) location directly construct a new URI without the localhost part and put it into gst_uri_get_location(), which also provides unescaping.
Comment 9 Sebastian Dröge (slomo) 2007-02-02 10:42:54 UTC
Committed...

2007-02-02  Sebastian Dröge  <slomo@circular-chaos.org>

        reviewed by: Wim Taymans <wim@fluendo.com>

        * plugins/elements/gstfilesink.c: (gst_file_sink_uri_set_uri):
        * plugins/elements/gstfilesrc.c: (gst_file_src_uri_set_uri):
        Allow file://localhost/foo/bar URLs and correctly fail for every other
        hostname that one sets. This was gnomevfssrc is linked for those if
        installed as it can handle it (#403172)