From 5114c69c7f85e7cd38d6928e874c5b44c951be60 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 7 Sep 2018 23:02:36 +0200 Subject: demux: change hack for closing subtitle files early Subtitles (and a few other file types, like playlists) are not streamed, but fully read on opening. This means keeping the file handle or network socket open is a waste of resources and could cause other weird behavior. This is why there's a hack to close them after opening. Change this hack to make the demuxer itself do this, which is less weird. (Until recently, demuxer->stream ownership was more complex, which is why it was done this way.) There is some evil shit due to a huge ownership/lifetime mess of various objects. Especially EDL (the currently only nested demuxer case) requires being careful about mp_cancel and passing down stream pointers. As one defensive programming measure, stop accessing the "stream" variable in open_given_type(), even where it would still work. This includes removing a redundant line of code, and removing the peak call, which should not be needed anymore, as the remaining demuxers do this mostly correctly. --- demux/demux_libarchive.c | 1 + 1 file changed, 1 insertion(+) (limited to 'demux/demux_libarchive.c') diff --git a/demux/demux_libarchive.c b/demux/demux_libarchive.c index 41b05368ca..c20990ae64 100644 --- a/demux/demux_libarchive.c +++ b/demux/demux_libarchive.c @@ -85,6 +85,7 @@ static int open_file(struct demuxer *demuxer, enum demux_check check) demuxer->fully_read = true; mp_archive_free(mpa); + demux_close_stream(demuxer); return 0; } -- cgit v1.2.3