diff options
author | wm4 <wm4@nowhere> | 2016-08-26 13:05:14 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-08-26 13:34:52 +0200 |
commit | bc97d60542b353141bedeee985f9e5bd68b9f076 (patch) | |
tree | 63a0f4d0e077929ad0f46934e4f07c6016433e1f /DOCS/man | |
parent | 4121016689668921538317449c0ea9063fc086fc (diff) |
demux: close underlying stream if it's fully read anyway
This is for text subtitles. libavformat currently always reads text
subtitles completely on init. This means the underlying stream is
useless and will consume resources for various reasons (network
connection, file handles, cache memory).
Take care of this by closing the underlying stream if we think the
demuxer has read everything. Since libavformat doesn't export whether it
did (or whether it may access the stream again in the future), we rely
on a whitelist. Also, instead of setting the stream to NULL or so, set
it to an empty dummy stream. This way we don't have to litter the code
with NULL checks.
demux_lavf.c needs extra changes, because it tries to do clever things
for the sake of subtitle charset conversion.
The main reason we keep the demuxer etc. open is because we fell for
libavformat being so generic, and we tried to remove corresponding
special-cases in the higher-level player code. Some of this is forced
due to ass/srt mkv/mp4 demuxing being very similar to external text
files. In the future it might be better to do this in a more
straight-forward way, such as reading text subtitles into libass and
then discarding the demuxer entirely, but for aforementioned reasons
this could be more of a mess than the solution introduced by this
commit.
Probably fixes #3456.
Diffstat (limited to 'DOCS/man')
0 files changed, 0 insertions, 0 deletions