summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-09-28 00:12:52 +0200
committerwm4 <wm4@nowhere>2020-09-28 00:12:52 +0200
commit55d7f9ded197d82d172b7baf74b1a07640361ae8 (patch)
tree1b471a403226672006655a1a4212b14c49d38c4b /options
parent102a4a8b0654396de7a6355adcf2292a277b6595 (diff)
downloadmpv-55d7f9ded197d82d172b7baf74b1a07640361ae8.tar.bz2
mpv-55d7f9ded197d82d172b7baf74b1a07640361ae8.tar.xz
player: add automatic loading of external cover art files
Picks up files like "cover.jpg". It's made part of normal external file loading, so I'm adding 3 new options that are direct equivalents for the options that control loading of external subtitle and audio files. Even though I bet nobody wants them and they just increase confusion... I guess the world is actually hell, so this outcome should be fine. It prefers non-specific external files like "cover.jpg" over embedded cover art. Not sure if that's wanted or unwanted. There's some pain over explicitly marking such files as external pictures. This is basically an optimization: in most cases, a heuristic would treat an image file loaded with --external-file the same (it's a heuristic because ffmpeg can't tell us whether something is an image or a video). However, even with this heuristic, it would decode the cover art picture again on each seek, which would essentially slow down seeking in audio files. This bothered me greatly, which is why I'm adding these additional options at all, and bothered with the previous commit. Fixes: #3056
Diffstat (limited to 'options')
-rw-r--r--options/options.c12
-rw-r--r--options/options.h2
2 files changed, 12 insertions, 2 deletions
diff --git a/options/options.c b/options/options.c
index 6da8e7fbef..51df987c6e 100644
--- a/options/options.c
+++ b/options/options.c
@@ -512,8 +512,6 @@ static const m_option_t mp_opts[] = {
#endif
// demuxer.c - select audio/sub file/demuxer
- {"audio-files", OPT_PATHLIST(audio_files), .flags = M_OPT_FILE},
- {"audio-file", OPT_CLI_ALIAS("audio-files-append")},
{"demuxer", OPT_STRING(demuxer_name)},
{"audio-demuxer", OPT_STRING(audio_demuxer_name)},
{"sub-demuxer", OPT_STRING(sub_demuxer_name)},
@@ -573,15 +571,24 @@ static const m_option_t mp_opts[] = {
{"sub-files", OPT_PATHLIST(sub_name), .flags = M_OPT_FILE},
{"sub-file", OPT_CLI_ALIAS("sub-files-append")},
+ {"audio-files", OPT_PATHLIST(audio_files), .flags = M_OPT_FILE},
+ {"audio-file", OPT_CLI_ALIAS("audio-files-append")},
+ {"cover-art-files", OPT_PATHLIST(coverart_files), .flags = M_OPT_FILE},
+ {"cover-art-file", OPT_CLI_ALIAS("covert-art-files-append")},
+
{"sub-file-paths", OPT_PATHLIST(sub_paths), .flags = M_OPT_FILE},
{"audio-file-paths", OPT_PATHLIST(audiofile_paths), .flags = M_OPT_FILE},
+
{"external-files", OPT_PATHLIST(external_files), .flags = M_OPT_FILE},
{"external-file", OPT_CLI_ALIAS("external-files-append")},
{"autoload-files", OPT_FLAG(autoload_files)},
+
{"sub-auto", OPT_CHOICE(sub_auto,
{"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})},
{"audio-file-auto", OPT_CHOICE(audiofile_auto,
{"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})},
+ {"cover-art-auto", OPT_CHOICE(coverart_auto,
+ {"no", -1}, {"fuzzy", 1})},
{"", OPT_SUBSTRUCT(subs_rend, mp_subtitle_sub_opts)},
{"", OPT_SUBSTRUCT(subs_filt, mp_sub_filter_opts)},
@@ -1002,6 +1009,7 @@ static const struct MPOpts mp_default_opts = {
.pitch_correction = 1,
.sub_auto = 0,
.audiofile_auto = -1,
+ .coverart_auto = 1,
.osd_bar_visible = 1,
.screenshot_template = "mpv-shot%n",
.play_dir = 1,
diff --git a/options/options.h b/options/options.h
index 68f8bed052..606bc6c8a2 100644
--- a/options/options.h
+++ b/options/options.h
@@ -291,10 +291,12 @@ typedef struct MPOpts {
char **sub_name;
char **sub_paths;
char **audiofile_paths;
+ char **coverart_files;
char **external_files;
int autoload_files;
int sub_auto;
int audiofile_auto;
+ int coverart_auto;
int osd_bar_visible;
int w32_priority;