From 7221e28fe3d743aaf6357bb0838e762781644f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Sat, 26 Feb 2011 20:59:16 +0100 Subject: subs: move text sub loading logic down to find_subfiles.c Move path handling for loading external subtitle files from mplayer.c to find_subfiles.c. Now the remaining code in mplayer.c only gets a list of potential filenames and tries opening those. --- sub/find_subfiles.c | 11 ++++++++++- sub/find_subfiles.h | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'sub') diff --git a/sub/find_subfiles.c b/sub/find_subfiles.c index 72a6887bf6..19ee0f065b 100644 --- a/sub/find_subfiles.c +++ b/sub/find_subfiles.c @@ -4,6 +4,7 @@ #include #include "mp_msg.h" +#include "path.h" #include "sub/find_subfiles.h" #include "sub/sub.h" @@ -85,7 +86,7 @@ static int compare_sub_priority(const void *a, const void *b) } } -char **sub_filenames(const char *path, char *fname) +static char **sub_filenames(const char *path, const char *fname) { char *f_dir, *f_fname, *f_fname_noext, *f_fname_trim, *tmp, *tmp_sub_id; char *tmp_fname_noext, *tmp_fname_trim, *tmp_fname_ext, *tmpresult; @@ -269,3 +270,11 @@ char **sub_filenames(const char *path, char *fname) return result2; } + +char **find_text_subtitles(const char *fname) +{ + char *psub = get_path("sub/"); + char **tmp = sub_filenames(psub ? psub : "", fname); + free(psub); + return tmp; +} diff --git a/sub/find_subfiles.h b/sub/find_subfiles.h index 06105747dc..c9b0c9137e 100644 --- a/sub/find_subfiles.h +++ b/sub/find_subfiles.h @@ -21,6 +21,6 @@ #define MAX_SUBTITLE_FILES 128 -char **sub_filenames(const char *path, char *fname); +char **find_text_subtitles(const char *fname); #endif /* MPLAYER_FINDFILES_H */ -- cgit v1.2.3