Commit Graph

12 Commits

Author SHA1 Message Date
Anton Khirnov 9f61abc811 lavf: allow custom IO for all files
Some (de)muxers open additional files beyond the main IO context.
Currently, they call avio_open() directly, which prevents the caller
from using custom IO for such streams.

This commit adds callbacks to AVFormatContext that default to
avio_open2()/avio_close(), but can be overridden by the caller. All
muxers and demuxers using AVIO are switched to using those callbacks
instead of calling avio_open()/avio_close() directly.

(de)muxers that use the URLProtocol layer directly instead of AVIO
remain unconverted for now. This should be fixed in later commits.
2016-01-24 16:45:32 +01:00
Martin Storsjö 675ac56b7e Revert "lavf: Don't try to update files atomically with renames on windows"
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>
2014-11-27 09:29:47 +02:00
Martin Storsjö b9d08c77a4 lavf: Don't try to update files atomically with renames on windows
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>
2014-11-24 23:34:44 +02:00
Martin Storsjö 7fd10f66b7 hdsenc: Clear the previous codec tag when setting up the chained muxer
The chained flv muxer wants one set of tags - normally this set
could be signaled via the AVOutputFormat codec_tag field (as
smoothstreamingenc and dashenc do). hdsenc doesn't signal it, since
the FLV codec tag arrays aren't exported from flvenc.c. This can
lead to the caller keeping an original codec tag from the originating
container here, which would then be a mismatch for the FLV muxer.
Since we don't really care about what codec tag the caller might
have set, just clear it and let the lavf muxer layer set the right
one for the chained FLV muxer later instead.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-19 13:37:00 +02:00
Martin Storsjö f918b8a293 hdsenc: Use the right filename in an error message
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-19 13:36:43 +02:00
Luca Barbato 7785ce1c76 lavf: replace rename() with ff_rename()
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>
2014-10-24 23:42:53 +01:00
Martin Storsjö 28816050e4 lavf: Set the stream time base hint properly for chained muxers
This avoids warnings about using the codec time base as time
base hint.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-06 23:30:52 +03:00
Martin Storsjö 803e82276b libavformat: Check mkdir return error codes
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>
2014-09-07 23:20:29 +03:00
Michael Niedermayer 797f2a7913 hdsenc: Check the init_file() return code
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-12-14 17:48:46 +02:00
Michael Niedermayer b8ed15d637 hdsenc: Fix an off by one error in an array size check
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-12-14 17:48:42 +02:00
Michael Niedermayer 417927af3c hdsenc: Avoid integer overflow
Also remove a silly leftover pair of parentheses.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-12-14 17:48:28 +02:00
Martin Storsjö 435214a757 Add an HDS live fragmenting muxer
HDS fragments basically are FLV fragments wrapped in an ISO
media mdat atom.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-11-02 10:51:00 +02:00