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.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demux/demux.h') diff --git a/demux/demux.h b/demux/demux.h index 2c089be823..ed013a043c 100644 --- a/demux/demux.h +++ b/demux/demux.h @@ -32,7 +32,6 @@ enum demux_ctrl { DEMUXER_CTRL_SWITCHED_TRACKS = 1, - DEMUXER_CTRL_REPLACE_STREAM, }; #define MAX_SEEK_RANGES 10 @@ -295,6 +294,7 @@ int demuxer_add_chapter(demuxer_t *demuxer, char *name, double pts, uint64_t demuxer_id); void demux_set_stream_tags(struct demuxer *demuxer, struct sh_stream *sh, struct mp_tags *tags); +void demux_close_stream(struct demuxer *demuxer); void demux_metadata_changed(demuxer_t *demuxer); void demux_update(demuxer_t *demuxer); -- cgit v1.2.3