summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorClément Bœsch <ubitux@gmail.com>2011-02-26 20:59:16 +0100
committerUoti Urpala <uau@mplayer2.org>2011-04-20 04:22:52 +0300
commit7221e28fe3d743aaf6357bb0838e762781644f0d (patch)
treebce8922ea210b28bba43d5f5123f7f511c689fed /mplayer.c
parent9bcfbe4d4ff8c40fff45798ae7f907118218c17b (diff)
downloadmpv-7221e28fe3d743aaf6357bb0838e762781644f0d.tar.bz2
mpv-7221e28fe3d743aaf6357bb0838e762781644f0d.tar.xz
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.
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/mplayer.c b/mplayer.c
index 34e98d699d..59dff418d9 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -4569,15 +4569,12 @@ if(vo_spudec==NULL &&
add_subtitles(mpctx, opts->sub_name[i], sub_fps, 0);
}
if(opts->sub_auto) { // auto load sub file ...
- char *psub = get_path( "sub/" );
- char **tmp = sub_filenames((psub ? psub : ""), mpctx->filename);
- int i = 0;
- free(psub); // release the buffer created by get_path() above
- while (tmp[i]) {
- add_subtitles(mpctx, tmp[i], sub_fps, 1);
- free(tmp[i++]);
- }
- free(tmp);
+ char **tmp = find_text_subtitles(mpctx->filename);
+ for (int i = 0; tmp[i]; i++) {
+ add_subtitles(mpctx, tmp[i], sub_fps, 1);
+ free(tmp[i]);
+ }
+ free(tmp);
}
if (mpctx->set_of_sub_size > 0)
mpctx->sub_counts[SUB_SOURCE_SUBS] = mpctx->set_of_sub_size;