[vlc-devel] VLC file URI protocol bugs

Michael A. Puls II shadow2531 at gmail.com
Fri Jul 17 17:09:39 CEST 2009


Please see <http://forum.videolan.org/viewtopic.php?f=16&t=35815&start=0>.
(Please ignore problems 3, 4, 5 and 6 for this email. Will touch on them  
later, especially 3)

Basically, vlc doesn't support the file protocol completely.

VLC understands:
file:///drive:/foo/bar
file://///intranet_server/foo/bar

, but not their repsective equivalents of:
file://localhost/drive:/foo/bar
file://intranet_server/foo/bar

where the hostname goes between :// and / (and you use less "/" for the  
intranet version).

These equivalents are covered under RFC1738 - 3.10. It also says that  
'localhost' can be used to signify an empty hostname like you'd get for  
pages on your desktop for example.

Judging by the xspf playlists that vlc produces, it seems to treat  
"file://c:/" the same as "file:///c:/", so vlc supports "file://c:/" too.  
Browsers convert "file://c:/" to "file:///c:/" or "file://localhost/c:/",  
so that's O.K.

By VLC not supporting the file://hostname/ version of file URIs, the vlc  
plug-in doesn't work correctly in Opera on local pages. This is because  
Opera uses the 'hostname' version for file URIs (Firefox and Safari do  
not) and the plug-in uses document.location.href as a reference to  
determine a base URI for the mrl param.

Since Opera's document.location.href will have "file://localhost/c:/" in  
it for example, instead of "file:///c:/", the plug-in will produce an  
absolute path that it doesn't support. (Of course, if you put and absolute  
path like "file://localhost/c:/file.ogg" in the mrl param, it won't work  
either)

To partially work around the vlcplugin issue directly, using one of the  
following might work to convert "file://localhost/" to "file:///c:/"
<http://shadow2531.com/opera/testcases/plugins/vlc/0001-Convert-Opera-s-file-localhost-to-file.patch>
<http://shadow2531.com/opera/testcases/plugins/vlc/0001-Opera-compatibility-by-removing-localhost-part-from-.patch>

That would at least work around 'localhost' pages (but perhaps not  
intranet pages) in Opera.

However, that won't do anything for passing "file://localhost/c:/file.ogg"  
to vlc.exe, so it was suggested to fix things at the root of the problem,  
but I'm not sure where the root of the problem is.

Could someone please find the spot where vlc loads paths and just do a  
simple "file://localhost/" to "file:///" conversion before trying to load  
the file? That would be much appreciated.

Then, perhaps things could be improved more later so that  
"file://intranet_server/foo/bar" gets converted to  
"file://///intranet_server/foo/bar" before trying to load a file.

In short though, whatever makes the platform paths come out correctly for  
the given file URI would help.

If you would like to see a demo of the problem, download  
<http://shadow2531.com/opera/testcases/plugins/vlc/demo.zip>. Put the html  
file and ogg file on your desktop and load the html file in Opera. The vlc  
plugin won't be able to find the file because it will be trying to load  
"file://localhost/c:/documents%20and%20settings/user/desktop/Onceover%20-%20Long%20For%20Summer.ogg",  
which it won't be able to find because of the 'localhost' part.

Of course, you could just pass a URI like that to vlc.exe to reproduce too.

Thanks for any help.

-- 
Michael



More information about the vlc-devel mailing list