From 1b283f6b60cce278aeb0c4fb675faac493546ab6 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 4 Jan 2020 19:53:57 +0100 Subject: 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 --- demux/demux_libarchive.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'demux') 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), + }, }; -- cgit v1.2.3