[FFmpeg-devel] url_exists function in avio.c opens instead of checking existence

Maker aka Michele maker.py
Tue Jan 19 22:05:54 CET 2010

hello. This is my first post, so sorry for my bad English and for whatever
wrong i will do.

I started playing with ffmpeg code in order to try to fix this bug:

In few words, in avio.c uses url_open to check if an url exists
(libavformat/avio.c : 199). This is semantically wrong becouse it tries to
_open_ that file (in read-only) instead of checking his real existence. This
maybe create bugs if the target file is fifo (it loops), has 000 permissions
(fails), etc.
This can happen with whatever protocol.

so, I would like to receive some advice before starting:
my original idea was to extend the original URLProtocol structure (
doc here<http://cekirdek.pardus.org.tr/%7Eismail/ffmpeg-docs/structURLProtocol.html#eec7eb72a222542a27d237b8cf2671b4>)
with something like "  int(* url_exists )(URLContext *h, const char
*filename)  " and create some functions to check if filename exists using
stats. It's a clear solution, but I would make URLProtocol a little bigger.
 Then I would make a parse_url function (this actually is done by url_open
[111:135 lines], but it's not its job) and edit url_exists in order to use

Is this solution ok for you, or there's something better I could do?

More information about the ffmpeg-devel mailing list