diff options
author | Anton Khirnov <anton@khirnov.net> | 2016-01-16 17:53:43 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-01-24 16:45:32 +0100 |
commit | 9f61abc8111c7c43f49ca012e957a108b9cc7610 (patch) | |
tree | 87af58cf56a1298f4b9b6a242d9c3a9451388ec8 /libavformat/movenc.c | |
parent | 68395f8c99393c281a08139d20a7a04398b2fd04 (diff) |
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.
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 1026baeae2..c91286350c 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -4188,7 +4188,7 @@ static int shift_data(AVFormatContext *s) * writing, so we re-open the same output, but for reading. It also avoids * a read/seek/write/seek back and forth. */ avio_flush(s->pb); - ret = avio_open(&read_pb, s->filename, AVIO_FLAG_READ); + ret = s->io_open(s, &read_pb, s->filename, AVIO_FLAG_READ, NULL); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Unable to re-open %s output file for " "the second pass (faststart)\n", s->filename); @@ -4220,7 +4220,7 @@ static int shift_data(AVFormatContext *s) avio_write(s->pb, read_buf[read_buf_id], n); pos += n; } while (pos < pos_end); - avio_close(read_pb); + ff_format_io_close(s, &read_pb); end: av_free(buf); |