summaryrefslogtreecommitdiffstats
path: root/player/external_files.c
diff options
context:
space:
mode:
Diffstat (limited to 'player/external_files.c')
-rw-r--r--player/external_files.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/player/external_files.c b/player/external_files.c
index 06585bf18f..3aca20dfdb 100644
--- a/player/external_files.c
+++ b/player/external_files.c
@@ -39,7 +39,11 @@ static const char *const sub_exts[] = {"utf", "utf8", "utf-8", "idx", "sub",
static const char *const audio_exts[] = {"mp3", "aac", "mka", "dts", "flac",
"ogg", "m4a", "ac3", "opus", "wav",
- "wv",
+ "wv", "eac3", "thd",
+ NULL};
+
+static const char *const image_exts[] = {"jpg", "jpeg", "png", "gif", "bmp",
+ "webp",
NULL};
// Stolen from: vlc/-/blob/master/modules/meta_engine/folder.c#L40
@@ -79,18 +83,19 @@ static int test_ext(bstr ext)
return STREAM_SUB;
if (test_ext_list(ext, audio_exts))
return STREAM_AUDIO;
+ if (test_ext_list(ext, image_exts))
+ return STREAM_VIDEO;
return -1;
}
-static int test_cover_filename(bstr fname, int *priority)
+static int test_cover_filename(bstr fname)
{
for (int n = 0; cover_files[n]; n++) {
if (bstrcasecmp(bstr0(cover_files[n]), fname) == 0) {
- *priority = MP_ARRAY_SIZE(cover_files) - n;
- return STREAM_VIDEO;
+ return MP_ARRAY_SIZE(cover_files) - n;
}
}
- return -1;
+ return 0;
}
bool mp_might_be_subtitle_file(const char *filename)
@@ -191,10 +196,7 @@ static void append_dir_subtitles(struct mpv_global *global, struct MPOpts *opts,
talloc_steal(tmpmem2, dename.start);
// check what it is (most likely)
- int cover_prio = 0;
int type = test_ext(tmp_fname_ext);
- if (type < 0)
- type = test_cover_filename(dename, &cover_prio);
char **langs = NULL;
int fuzz = -1;
switch (type) {
@@ -244,15 +246,14 @@ static void append_dir_subtitles(struct mpv_global *global, struct MPOpts *opts,
if (bstr_find(tmp_fname_trim, f_fname_trim) >= 0 && fuzz >= 1)
prio |= 2; // contains the movie name
+ if (type == STREAM_VIDEO && fuzz >= 1 && prio == 0)
+ prio = test_cover_filename(dename);
+
// doesn't contain the movie name
// don't try in the mplayer subtitle directory
if (!limit_fuzziness && fuzz >= 2)
prio |= 1;
- // cover art: just accept it
- if (type == STREAM_VIDEO && fuzz >= 1)
- prio = cover_prio;
-
mp_dbg(log, "Potential external file: \"%s\" Priority: %d\n",
de->d_name, prio);