mpv/stream
wm4 33e999de82 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
2020-01-09 02:25:13 +01:00
..
cookies.c cookies: change license to LGPL 2017-05-11 07:29:01 +02:00
cookies.h cookies: change license to LGPL 2017-05-11 07:29:01 +02:00
dvb_tune.c dvb: Add multiple frontends support: MAX_FRONTENDS now 8. 2017-12-16 23:24:55 -08:00
dvb_tune.h dvb: Add multiple frontends support: MAX_FRONTENDS now 8. 2017-12-16 23:24:55 -08:00
dvbin.h stream_dvb: Remove now replaced stream-control code for good. 2019-10-02 01:25:45 +02:00
stream.c stream, demux: redo origin policy thing 2019-12-20 13:00:39 +01:00
stream.h stream, demux: redo origin policy thing 2019-12-20 13:00:39 +01:00
stream_avdevice.c stream, demux: redo origin policy thing 2019-12-20 13:00:39 +01:00
stream_bluray.c stream, demux: redo origin policy thing 2019-12-20 13:00:39 +01:00
stream_cb.c stream, demux: redo origin policy thing 2019-12-20 13:00:39 +01:00
stream_cdda.c stream, demux: redo origin policy thing 2019-12-20 13:00:39 +01:00
stream_concat.c stream_concat, stream_memory: more stream_origin stuff 2019-12-23 11:03:44 +01:00
stream_dvb.c stream_dvb: Remove implicit fallthroughs and consistify debug messages. 2019-12-28 19:16:07 +01:00
stream_dvdnav.c stream, demux: redo origin policy thing 2019-12-20 13:00:39 +01:00
stream_edl.c demux, stream: rip out the classic stream cache 2018-08-31 12:55:22 +02:00
stream_file.c stream, demux: redo origin policy thing 2019-12-20 13:00:39 +01:00
stream_lavf.c stream, demux: redo origin policy thing 2019-12-20 13:00:39 +01:00
stream_libarchive.c stream_libarchive: fix unnecessarily opening all volumes on opening 2020-01-09 02:25:13 +01:00
stream_libarchive.h libarchive: some shitty hack to make opening slightly faster 2020-01-04 19:56:09 +01:00
stream_memory.c stream_concat, stream_memory: more stream_origin stuff 2019-12-23 11:03:44 +01:00
stream_mf.c demux, stream: rip out the classic stream cache 2018-08-31 12:55:22 +02:00
stream_null.c stream_null: change license to LGPL 2017-05-08 12:45:50 +02:00
stream_smb.c stream, demux: redo origin policy thing 2019-12-20 13:00:39 +01:00