diff options
author | wm4 <wm4@nowhere> | 2020-01-04 19:53:57 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-01-04 19:56:09 +0100 |
commit | 1b283f6b60cce278aeb0c4fb675faac493546ab6 (patch) | |
tree | 8ff7a048c049f463e59d8452a6a75a049315412d /demux | |
parent | 4231ce6f5f6976c65a22853b77103cf4243e5f5f (diff) | |
download | mpv-1b283f6b60cce278aeb0c4fb675faac493546ab6.tar.bz2 mpv-1b283f6b60cce278aeb0c4fb675faac493546ab6.tar.xz |
libarchive: some shitty hack to make opening slightly faster
See manpage additions. The libarchive behavior mentioned in the last
paragraph there is technically unrelated, but makes this new option
mostly pointless.
See: #7182
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux_libarchive.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/demux/demux_libarchive.c b/demux/demux_libarchive.c index 31e0c2b418..4be5193b22 100644 --- a/demux/demux_libarchive.c +++ b/demux/demux_libarchive.c @@ -20,12 +20,17 @@ #include "common/common.h" #include "common/playlist.h" +#include "options/m_config.h" #include "stream/stream.h" #include "misc/natural_sort.h" #include "demux.h" #include "stream/stream_libarchive.h" +struct demux_libarchive_opts { + int rar_list_all_volumes; +}; + static int cmp_filename(const void *a, const void *b) { return mp_natural_sort_cmp(*(char **)a, *(char **)b); @@ -57,6 +62,12 @@ static int open_file(struct demuxer *demuxer, enum demux_check check) if (!ok) return -1; + struct demux_libarchive_opts *opts = + mp_get_config_group(demuxer, demuxer->global, demuxer->desc->options); + + if (!opts->rar_list_all_volumes) + flags |= MP_ARCHIVE_FLAG_NO_RAR_VOLUMES; + mpa = mp_archive_new(demuxer->log, demuxer->stream, flags, 0); if (!mpa) return -1; @@ -93,8 +104,17 @@ static int open_file(struct demuxer *demuxer, enum demux_check check) return 0; } +#define OPT_BASE_STRUCT struct demux_libarchive_opts + const struct demuxer_desc demuxer_desc_libarchive = { .name = "libarchive", .desc = "libarchive wrapper", .open = open_file, + .options = &(const struct m_sub_options){ + .opts = (const struct m_option[]) { + OPT_FLAG("rar-list-all-volumes", rar_list_all_volumes, 0), + {0} + }, + .size = sizeof(OPT_BASE_STRUCT), + }, }; |