mpv/demux
wm4 bc97d60542 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.
2016-08-26 13:34:52 +02:00
..
codec_tags.c Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
codec_tags.h Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
cue.c Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
cue.h Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
demux.c demux: close underlying stream if it's fully read anyway 2016-08-26 13:34:52 +02:00
demux.h demux: close underlying stream if it's fully read anyway 2016-08-26 13:34:52 +02:00
demux_cue.c Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
demux_disc.c player: improve instant track switching 2016-08-06 15:47:04 +02:00
demux_edl.c demux_edl: adjust warnings and variable names 2016-05-23 15:23:27 +02:00
demux_lavf.c demux: close underlying stream if it's fully read anyway 2016-08-26 13:34:52 +02:00
demux_libarchive.c libarchive: unify entry iteration between stream/demux layers 2016-07-18 12:44:56 +02:00
demux_mf.c video/audio: always provide "proper" timestamps to libavcodec 2016-08-19 14:59:30 +02:00
demux_mkv.c demux: add per-track metadata 2016-08-12 21:39:32 +02:00
demux_mkv_timeline.c Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
demux_null.c demux_null: fix segfault with --cache enabled 2016-03-05 00:56:55 +01:00
demux_playlist.c demux_playlist: recognize m3u8 as playlist extension 2016-05-17 18:18:00 +02:00
demux_rar.c Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
demux_raw.c video/audio: always provide "proper" timestamps to libavcodec 2016-08-19 14:59:30 +02:00
demux_timeline.c demux_timeline: enable refresh seeks in some situations 2016-08-07 13:53:34 +02:00
demux_tv.c demux: merge sh_video/sh_audio/sh_sub 2016-01-12 23:48:19 +01:00
ebml.c mpv_talloc.h: rename from talloc.h 2016-01-11 21:05:55 +01:00
ebml.h Update license headers 2015-04-13 12:10:01 +02:00
matroska.h demux_mkv: remove indirection through defines 2015-06-19 21:41:57 +02:00
packet.c Rewrite ordered chapters and timeline stuff 2016-02-15 21:04:07 +01:00
packet.h Rewrite ordered chapters and timeline stuff 2016-02-15 21:04:07 +01:00
stheader.h demux: change fps field to double 2016-08-19 15:00:58 +02:00
timeline.c demux: timeline: honor quit requests 2015-02-20 22:08:02 +01:00
timeline.h demux: timeline: honor quit requests 2015-02-20 22:08:02 +01:00