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.
This commit is contained in:
Anton Khirnov
2016-01-16 17:53:43 +01:00
parent 68395f8c99
commit 9f61abc811
15 changed files with 130 additions and 68 deletions

View File

@@ -3176,3 +3176,10 @@ uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
sd->size = size;
return data;
}
void ff_format_io_close(AVFormatContext *s, AVIOContext **pb)
{
if (*pb)
s->io_close(s, *pb);
*pb = NULL;
}