[FFmpeg-devel] Allow output files as read-write

Reimar Döffinger Reimar.Doeffinger at gmx.de
Fri Jan 20 20:12:16 CET 2012


On Fri, Jan 20, 2012 at 10:05:51AM +0000, Collins, Andrew wrote:
> I completely agree with your thoughts on it being a bad idea to make a generalisation when opening the output for protocols where it is not possible to read-write and another approach may be to look at a change in file.c. However, this does also bring the question that even if file.c were modified for special behaviour FFMPEG is still asking at a logical level to always open the file for write (only), rather than requesting it be opened for read-write.

I don't know, but are you completely misunderstanding what "opening a
file for writing only" means?
It means that via that _specific_ handle the file can only be written.
It does _not_ mean that this or another application can not also
open the file for reading, writing or whatever.
With so-called mandatory locking you can prevent others to access the
file in certain ways, but in all implementations I know (including
Windows) what you allow or forbid other applications to do with the
file is completely unrelated to what access you request yourself.
For Windows the default is to not allow any other access if the
requested access includes writes, and otherwise to only not allow
others to write.
This means in the default behaviour it does not matter whether you
open the file for write or for read and write access.
Thus my suspicion that there is something seriously wrong on the
environment (e.g. MinGW libc-related code).
However I just remembered that we actually use a special ff_win32_open
(in libavformat/os_support.c) on Windows, though I can't see anything
wrong with it.
At least it would be an obvious place to use _sopen instead though.

Reimar


More information about the ffmpeg-devel mailing list