From 2aa5964b43fdd1d584b4f17899aa1ac5e886b7af Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Mon, 27 Apr 2020 01:13:59 -0700 Subject: stream_libarchive: remember archive headers from initial open The header probing hacks were previously all broken. They only worked the first time the archive file was open. Since subsequent opens (on seek) occured in the middle of the source stream rather than at the beginning, the stream_read_peek calls meant to retrieve the headers were instead returning random bytes in the middle of the file. Perhaps the worst manifestation of this was when seeking within a multi-volume .rar archive with the "legacy" file naming pattern. If the seek required a reopen, the fact that the archive was multi-volume would be forgotten and the file would appear truncated terminating playback. To solve this, only perform the header probling the first time the archive is opened. Save the results and reuse them on subsequent reopens. Put this in a wrapper so this is transparent to demux_libarchive. --- demux/demux_libarchive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demux/demux_libarchive.c') diff --git a/demux/demux_libarchive.c b/demux/demux_libarchive.c index dc8d201b19..9873232851 100644 --- a/demux/demux_libarchive.c +++ b/demux/demux_libarchive.c @@ -66,7 +66,7 @@ static int open_file(struct demuxer *demuxer, enum demux_check check) mp_get_config_group(demuxer, demuxer->global, demuxer->desc->options); if (!opts->rar_list_all_volumes) - flags |= MP_ARCHIVE_FLAG_NO_RAR_VOLUMES; + flags |= MP_ARCHIVE_FLAG_NO_VOLUMES; mpa = mp_archive_new(demuxer->log, demuxer->stream, flags, 0); if (!mpa) -- cgit v1.2.3