This reverts commit b9d08c77a4.
After taking MoveFileEx into use, we can replace files with renames
on windows as well.
Signed-off-by: Martin Storsjö <martin@martin.st>
On windows, rename(2) will fail if the target file exists. On
unix this trick is used to make sure that people reading the file
either will get the full previous file, or the full new version
of the file, but no intermediate version.
Signed-off-by: Martin Storsjö <martin@martin.st>
The new function wraps errno so that its value is correctly reported
when other functions overwrite it (eg. in case of logging).
CC: libav-stable@libav.org
Bug-Id: CID 1135748
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Previously, the returned error codes were intentionally ignored
(see fadd3a6821), to avoid aborting if the directory already
existed. If the mkdir actually failed, this was caught when
opening files within the directory fails anyway.
By handling the error code here (but explicitly ignoring EEXIST),
the error messages and return codes in these cases are more
appropriate and less confusing.
Signed-off-by: Martin Storsjö <martin@martin.st>
When av_reallocp fails, the associated variables that keep track of
the number of elements in the array (and in some cases, the
separate number of allocated elements) need to be reset.
Not all of these might technically be needed, but it's better to
reset them if in doubt, to make sure variables don't end up
conflicting.
Signed-off-by: Martin Storsjö <martin@martin.st>
If a client tries to read the file while it's being updated, the client
would get an incomplete manifest. Instead write to a separate temp file
and atomically rename it to replace the previous one.
Signed-off-by: Martin Storsjö <martin@martin.st>
We don't need to return an error if the directory already existed.
We make sure that the directory actually is properly writeable later
within ism_write_header by writing a manifest anyway.
Signed-off-by: Martin Storsjö <martin@martin.st>
This fixes stream copy from a format that already has incompatible
codec tags set. The chained ismv muxer exports this same codec tag
list, so set it on this one as well, to allow the caller (and
lavf common code) to set them correctly.
Signed-off-by: Martin Storsjö <martin@martin.st>
This muxer splits the output from the ismv muxer into individual
files, in realtime.
The same can also be done by the standalone tool ismindex, but this
muxer is needed for doing it in realtime (especially for live
streams that need extra handling for updating the lookahead fields
in the fragment headers).
Using this muxer, one can deliver live smooth streaming from a
normal static file web server. (Using ismindex, one can deliver
premade smooth streaming files from a static file web server,
or prepare files for serving with IIS.)
Signed-off-by: Martin Storsjö <martin@martin.st>