diff options
author | wm4 <wm4@nowhere> | 2020-01-09 02:25:13 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-01-09 02:25:13 +0100 |
commit | 33e999de82dffcdd1404468a8e93eef8b7cc99a3 (patch) | |
tree | a5b68a3b9f4f67d2a6a51cb359a479df9adc7334 /stream/stream.c | |
parent | 5e0875c9e04e6773575703b50264ea39c39bf56c (diff) | |
download | mpv-33e999de82dffcdd1404468a8e93eef8b7cc99a3.tar.bz2 mpv-33e999de82dffcdd1404468a8e93eef8b7cc99a3.tar.xz |
stream_libarchive: fix unnecessarily opening all volumes on opening
Seems like I'm still not done with rar playback stuff...
It turns out the reason for archive_read_open1() opening all volumes had
nothing to do with libarchive's rar code, but was a consequence of how
multi volume support is implemented in libarchive, and due to the fact
that we enabled archive_read_support_format_zip_seekable() (through
archive_read_support_format_zip()).
The seekable zip format will seek to the end of the file and search for
a zip "header" there. It could possibly be considered a libarchive bug
that it does that even if it's fairly sure that it's a RAR file.
We already do probing on a small buffer read from the start of the file
(i.e. not giving libarchive a way to seek the stream before we think
it's an archive), but that does not help, since libarchive needs to
probe _again_. libarchive does not seem to provide a function to query
the format (no archive_read_get_format()). Which seems quite strange,
but at least I didn't find one.
This commit works this around by doing some manual rar/zip probing. We
could have gone only with rar probing. But detecting zip separately
allows us to avoid that stream_libarchive seeks to the end during early
probing. This is an additional bonus on top of "fixing" multi volume
rar.
The zip probing is from archive_read_format_zip_streamable_bid(). The
rar signature is the common prefix of the rar and rar5 formats in
libarchive (presumably the RAR fixed header parts without version).
If the demuxer seeks to the end of the rar entry, this will still open
all volumes; I'm not sure whether the old/removed rar code in mpv could
handle this better.
See: #7182
Diffstat (limited to 'stream/stream.c')
0 files changed, 0 insertions, 0 deletions