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

Stefano Sabatini stefano.sabatini-lala
Wed Jan 20 00:04:03 CET 2010


On date Tuesday 2010-01-19 23:33:37 +0100, Maker aka Michele encoded:
> > What about a url_check(file, flag) function, which checks if it is
> > possible to open a file/url with a certain mode?
> >
> > Then we could deprecate url_exist() and use that instead.
> >
> Yeah, it would solve the problem with pipe output (like you said, opening
> in write_only). But what about files in 000 mode?
>
> Also, how to recognize a fifo file? there would be so many nested if to make
> that function complicated - and just for an exception.
> Uh, and  now, with ffmpeg:
> 
> $ touch some_movie.mp4
> $ chmod 000 some_movie.mp4
> $ chmod +r some_movie.mp4
> $ ffmpeg -i foo.avi -f mp4 [...] some_movie.mp4
> [blablablabla]
> File 'some_movie.mp4' already exists. Overwrite ? [y/N] y
> Could not open 'some_movie.mp4'

if ((ret = url_check(file, w) != AVERROR(ENOENT))  // the file exists
    ask_for_overwrite_confirmation();

url_check() may also be used to check for existence.

> It seems that ffmpeg already manages output write-protected. Shouldn't it be
> duplicate code?

Regards.
-- 
FFmpeg = Fantastic Fucking Multimedia Puristic Empowered Gnome



More information about the ffmpeg-devel mailing list