summaryrefslogtreecommitdiffstats
path: root/sub/find_subfiles.c
diff options
context:
space:
mode:
Diffstat (limited to 'sub/find_subfiles.c')
-rw-r--r--sub/find_subfiles.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/sub/find_subfiles.c b/sub/find_subfiles.c
index 19ee0f065b..862afe53c6 100644
--- a/sub/find_subfiles.c
+++ b/sub/find_subfiles.c
@@ -5,6 +5,7 @@
#include "mp_msg.h"
#include "path.h"
+#include "mpcommon.h"
#include "sub/find_subfiles.h"
#include "sub/sub.h"
@@ -278,3 +279,27 @@ char **find_text_subtitles(const char *fname)
free(psub);
return tmp;
}
+
+char **find_vob_subtitles(const char *fname)
+{
+ char **vobs = talloc_array_ptrtype(NULL, vobs, 1);
+ int n = 0;
+
+ // Potential vobsub in the media directory
+ struct bstr bname = BSTR(mp_basename(fname));
+ int pdot = bstrrchr(bname, '.');
+ if (pdot >= 0)
+ bname.len = pdot;
+ vobs[n++] = mp_path_join(vobs, mp_dirname(fname), bname);
+
+ // Potential vobsub in ~/.mplayer/sub
+ char *mp_subdir = get_path("sub/");
+ if (mp_subdir) {
+ MP_GROW_ARRAY(vobs, n);
+ vobs[n++] = mp_path_join(vobs, BSTR(mp_subdir), bname);
+ }
+
+ free(mp_subdir);
+ MP_RESIZE_ARRAY(NULL, vobs, n);
+ return vobs;
+}