1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 01:22:30 +00:00

demux_playlist: add --directory-mode=auto

This is a more useful default with --shuffle.
This commit is contained in:
Guido Cella 2023-09-19 21:16:23 +02:00 committed by Dudemanguy
parent 27f0a35c53
commit 6b09525157
3 changed files with 15 additions and 3 deletions

View File

@ -72,6 +72,7 @@ Interface changes
- update defaults to `--hdr-peak-decay-rate=20`, `--hdr-scene-threshold-low=1.0`,
`--hdr-scene-threshold-high=3.0`
- update defaults to `--deband-threshold=48`, `--deband-grain=32`
- add `--directory-mode=auto` and make it the default
--- mpv 0.36.0 ---
- add `--target-contrast`
- Target luminance value is now also applied when ICC profile is used.

View File

@ -3985,9 +3985,10 @@ Demuxer
libarchive opens all volumes anyway when playing the main file, even though
mpv iterated no archive entries yet.
``--directory-mode=<lazy|recursive|ignore>``
``--directory-mode=<auto|lazy|recursive|ignore>``
When opening a directory, open subdirectories lazily, recursively or not at
all (default: lazy).
all. The default is ``auto``, which behaves like ``recursive`` with
``--shuffle``, and like ``lazy`` otherwise.
Input
-----

View File

@ -37,6 +37,7 @@
#define PROBE_SIZE (8 * 1024)
enum dir_mode {
DIR_AUTO,
DIR_LAZY,
DIR_RECURSIVE,
DIR_IGNORE,
@ -50,6 +51,7 @@ struct demux_playlist_opts {
struct m_sub_options demux_playlist_conf = {
.opts = (const struct m_option[]) {
{"directory-mode", OPT_CHOICE(dir_mode,
{"auto", DIR_AUTO},
{"lazy", DIR_LAZY},
{"recursive", DIR_RECURSIVE},
{"ignore", DIR_IGNORE})},
@ -57,7 +59,7 @@ struct m_sub_options demux_playlist_conf = {
},
.size = sizeof(struct demux_playlist_opts),
.defaults = &(const struct demux_playlist_opts){
.dir_mode = DIR_LAZY,
.dir_mode = DIR_AUTO,
},
};
@ -73,6 +75,7 @@ static bool check_mimetype(struct stream *s, const char *const *list)
}
struct pl_parser {
struct mpv_global *global;
struct mp_log *log;
struct stream *s;
char buffer[2 * 1024 * 1024];
@ -434,6 +437,12 @@ static int parse_dir(struct pl_parser *p)
struct stat dir_stack[MAX_DIR_STACK];
if (p->opts->dir_mode == DIR_AUTO) {
struct MPOpts *opts = mp_get_config_group(NULL, p->global, &mp_opt_root);
p->opts->dir_mode = opts->shuffle ? DIR_RECURSIVE : DIR_LAZY;
talloc_free(opts);
}
scan_dir(p, path, dir_stack, 0);
p->add_base = false;
@ -486,6 +495,7 @@ static int open_file(struct demuxer *demuxer, enum demux_check check)
bool force = check < DEMUX_CHECK_UNSAFE || check == DEMUX_CHECK_REQUEST;
struct pl_parser *p = talloc_zero(NULL, struct pl_parser);
p->global = demuxer->global;
p->log = demuxer->log;
p->pl = talloc_zero(p, struct playlist);
p->real_stream = demuxer->stream;