summaryrefslogtreecommitdiffstats
path: root/stream/stream_libarchive.h
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2020-04-27 01:13:59 -0700
committerKevin Mitchell <kevmitch@gmail.com>2020-04-28 22:13:03 -0700
commit2aa5964b43fdd1d584b4f17899aa1ac5e886b7af (patch)
tree4dd23c355052706b203b983706fd6c3ff83109ce /stream/stream_libarchive.h
parent9285a1c05e2c5f55caa5cbaa24a504bb24e7dbc4 (diff)
downloadmpv-2aa5964b43fdd1d584b4f17899aa1ac5e886b7af.tar.bz2
mpv-2aa5964b43fdd1d584b4f17899aa1ac5e886b7af.tar.xz
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.
Diffstat (limited to 'stream/stream_libarchive.h')
-rw-r--r--stream/stream_libarchive.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/stream/stream_libarchive.h b/stream/stream_libarchive.h
index f9e05fcbee..151e4ee3e5 100644
--- a/stream/stream_libarchive.h
+++ b/stream/stream_libarchive.h
@@ -14,6 +14,7 @@ struct mp_archive {
struct archive *arch;
struct stream *primary_src;
char buffer[4096];
+ int flags;
int num_volumes; // INT_MAX if unknown (initial state)
// Current entry, as set by mp_archive_next_entry().
@@ -25,7 +26,9 @@ struct mp_archive {
void mp_archive_free(struct mp_archive *mpa);
#define MP_ARCHIVE_FLAG_UNSAFE (1 << 0)
-#define MP_ARCHIVE_FLAG_NO_RAR_VOLUMES (1 << 1)
+#define MP_ARCHIVE_FLAG_NO_VOLUMES (1 << 1)
+#define MP_ARCHIVE_FLAG_PRIV (1 << 2)
+
struct mp_archive *mp_archive_new(struct mp_log *log, struct stream *src,
int flags, int max_volumes);