[FFmpeg-devel] [PATCH] Use file protocol to deal with bogus protocol strings

Stefano Sabatini stefano.sabatini-lala
Thu Sep 27 22:31:32 CEST 2007

Hi all,

suggested log: make libavformat/avio.c:url_open use the file protocol
to read filenames with a bogus protocol string.

This patch fixes issue number 181.

For example actually when reading the file "foo:movie.mpeg"
ffmpeg fails with:
foo:movie.mpeg: no such file or directory

To increase confusion if you try instead:
ffmpeg -i /path/to/foo:movie.mpeg ...

it will work.

My solution is to make url_open force the use of the file protocol
when dealing with fake protocol string at the beginning of the
filename. In this way for example "foo:movie.mpeg" is interpreted
exactly as "file:foo:movie.mpeg"; a filename "weird:path/movie.mpeg"
is interpreted as "file:weird:path/movie.mpeg". 

Since the patch is adding a new function to the api
(find_protocol_by_name), I'm also increasing the minor version number
of libavformat.

Another (maybe cleaner) solution would be to request the user to
specify the protocol string for ambiguos files such as foo:movie.mpeg,
which should then be specified as file:foo:movie.mpeg. Anyway in this
case ffmpeg should say something if it can't recognize the protocol
(for example: unrecognized protocol: foo), rather than simply negate
the existence of the file.

Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interpret-as-file-bogus-protocols-strings-00.patch
Type: text/x-diff
Size: 2998 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070927/bc309070/attachment.patch>

More information about the ffmpeg-devel mailing list