[MPlayer-cvslog] r32860 - in trunk: DOCS/man/en/mplayer.1 cfg-common.h mencoder.c mpcommon.h mplayer.c sub/subreader.c
cboesch
subversion at mplayerhq.hu
Sat Feb 5 21:38:02 CET 2011
Author: cboesch
Date: Sat Feb 5 21:38:02 2011
New Revision: 32860
Log:
Add sub-paths option.
This option allows specifying extra subtitles (relative and absolute) paths to
track.
Modified:
trunk/cfg-common.h
trunk/mencoder.c
trunk/mpcommon.h
trunk/mplayer.c
trunk/sub/subreader.c
Changes in other areas also in this revision:
Modified:
trunk/DOCS/man/en/mplayer.1
Modified: trunk/cfg-common.h
==============================================================================
--- trunk/cfg-common.h Sat Feb 5 21:05:38 2011 (r32859)
+++ trunk/cfg-common.h Sat Feb 5 21:38:02 2011 (r32860)
@@ -562,6 +562,7 @@ const m_option_t common_opts[] = {
// ------------------------- subtitles options --------------------
{"sub", &sub_name, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
+ {"sub-paths", &sub_paths, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
#ifdef CONFIG_FRIBIDI
{"fribidi-charset", &fribidi_charset, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"flip-hebrew", &flip_hebrew, CONF_TYPE_FLAG, 0, 0, 1, NULL},
Modified: trunk/mencoder.c
==============================================================================
--- trunk/mencoder.c Sat Feb 5 21:05:38 2011 (r32859)
+++ trunk/mencoder.c Sat Feb 5 21:38:02 2011 (r32860)
@@ -179,6 +179,7 @@ char *font_name=NULL;
char *sub_font_name=NULL;
float font_factor=0.75;
char **sub_name=NULL;
+char **sub_paths = NULL;
float sub_delay=0;
float sub_fps=0;
int sub_auto = 0;
Modified: trunk/mpcommon.h
==============================================================================
--- trunk/mpcommon.h Sat Feb 5 21:05:38 2011 (r32859)
+++ trunk/mpcommon.h Sat Feb 5 21:38:02 2011 (r32860)
@@ -37,6 +37,7 @@ extern int sub_auto;
extern float sub_delay;
extern float sub_fps;
extern char **sub_name;
+extern char **sub_paths;
extern char *font_name;
extern char *sub_font_name;
extern char *audio_lang;
Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c Sat Feb 5 21:05:38 2011 (r32859)
+++ trunk/mplayer.c Sat Feb 5 21:38:02 2011 (r32860)
@@ -290,6 +290,7 @@ char *font_name=NULL;
char *sub_font_name=NULL;
float font_factor=0.75;
char **sub_name=NULL;
+char **sub_paths = NULL;
float sub_delay=0;
float sub_fps=0;
int sub_auto = 1;
Modified: trunk/sub/subreader.c
==============================================================================
--- trunk/sub/subreader.c Sat Feb 5 21:05:38 2011 (r32859)
+++ trunk/sub/subreader.c Sat Feb 5 21:38:02 2011 (r32860)
@@ -2088,6 +2088,19 @@ void load_subtitles(const char *fname, f
append_dir_subtitles(&slist, path, fname, 0);
free(path);
+ // Load subtitles in dirs specified by sub-paths option
+ if (sub_paths) {
+ for (i = 0; sub_paths[i]; i++) {
+ path = mp_path_join(fname, sub_paths[i]);
+ if (!path) {
+ free(slist.subs);
+ return;
+ }
+ append_dir_subtitles(&slist, path, fname, 0);
+ free(path);
+ }
+ }
+
// Load subtitles in ~/.mplayer/sub limiting sub fuzziness
mp_subdir = get_path("sub/");
if (mp_subdir)
@@ -2115,7 +2128,7 @@ void load_subtitles(const char *fname, f
void load_vob_subtitle(const char *fname, const char * const ifo, void **spu,
open_vob_func add_f)
{
- char *name, *mp_subdir;
+ char *name = NULL, *mp_subdir = NULL;
// Load subtitles specified by vobsub option
if (vobsub_name) {
@@ -2137,6 +2150,30 @@ void load_vob_subtitle(const char *fname
return;
}
+ // Try looking at the dirs specified by sub-paths option
+ if (sub_paths) {
+ int i;
+
+ for (i = 0; sub_paths[i]; i++) {
+ char *path, *psub;
+
+ path = mp_path_join(fname, sub_paths[i]);
+ if (!path)
+ goto out;
+
+ psub = mp_dir_join(path, mp_basename(name));
+ free(path);
+ if (!psub)
+ goto out;
+
+ if (add_f(psub, ifo, 0, spu)) {
+ free(psub);
+ goto out;
+ }
+ free(psub);
+ }
+ }
+
// If still no VOB found, try loading it from ~/.mplayer/sub
mp_subdir = get_path("sub/");
if (mp_subdir) {
@@ -2144,6 +2181,8 @@ void load_vob_subtitle(const char *fname
add_f(psub, ifo, 0, spu);
free(psub);
}
+
+out:
free(mp_subdir);
free(name);
}
More information about the MPlayer-cvslog
mailing list