1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-01 20:52:05 +00:00

options: merge ---sub-auto-match with --sub-auto

There's no reason why these should be separate.
This commit is contained in:
wm4 2014-05-04 10:31:24 +02:00
parent f26fe90c8a
commit 94441ed139
6 changed files with 13 additions and 18 deletions

View File

@ -195,7 +195,7 @@ Command Line Switches
``-srate`` ``--audio-samplerate``
``-ss`` ``--start``
``-stop-xscreensaver`` ``--stop-screensaver``
``-sub-fuzziness`` ``--sub-auto-match``
``-sub-fuzziness`` ``--sub-auto``
``-sub`` ``--sub-file``
``-subcp`` ``--sub-codepage``
``-subdelay`` ``--sub-delay``

View File

@ -2168,19 +2168,16 @@ OPTIONS
Use/display these subtitle files. Only one file can be displayed at the
same time.
``--sub-auto``, ``--no-sub-auto``
Load additional subtitle files matching the video filename. Enabled by
default. See also ``--sub-auto-match``.
``--sub-auto=<no|exact|fuzzy|all>``, ``--no-sub-auto``
Load additional subtitle files matching the video filename. The parameter
specifies how external subtitle files are matched. ``exact`` is enabled by
default.
``--sub-auto-match=<exact|fuzzy|all>``
Adjust matching fuzziness when searching for subtitles:
:exact: exact match
:no: Don't automatically load external subtitle files.
:exact: Load the media filename with subtitle file extension (default).
:fuzzy: Load all subs containing movie name.
:all: Load all subs in the current and ``--sub-paths`` directories.
(default: exact)
``--sub-paths=<path1:path2:...>``
Specify extra directories to search for subtitles matching the video.
Multiple directories can be separated by ":" (";" on Windows).

View File

@ -407,13 +407,12 @@ const m_option_t mp_opts[] = {
OPT_FLOAT("sub-delay", sub_delay, 0),
OPT_FLOAT("sub-fps", sub_fps, 0),
OPT_FLOAT("sub-speed", sub_speed, 0),
OPT_FLAG("sub-auto", sub_auto, 0),
OPT_FLAG("sub-visibility", sub_visibility, 0),
OPT_FLAG("sub-forced-only", forced_subs_only, 0),
OPT_FLAG("stretch-dvd-subs", stretch_dvd_subs, 0),
OPT_FLAG_CONSTANTS("sub-fix-timing", suboverlap_enabled, 0, 1, 0),
OPT_CHOICE("sub-auto-match", sub_match_fuzziness, 0,
({"exact", 0}, {"fuzzy", 1}, {"all", 2})),
OPT_CHOICE("sub-auto", sub_auto, 0,
({"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})),
OPT_INTRANGE("sub-pos", sub_pos, 0, 0, 100),
OPT_FLOATRANGE("sub-gauss", sub_gauss, 0, 0.0, 3.0),
OPT_FLAG("sub-gray", sub_gray, 0),
@ -717,7 +716,7 @@ const struct MPOpts mp_default_opts = {
.playback_speed = 1.,
.movie_aspect = -1.,
.field_dominance = -1,
.sub_auto = 1,
.sub_auto = 0,
.osd_bar_visible = 1,
#if HAVE_LIBASS
.ass_enabled = 1,

View File

@ -196,7 +196,6 @@ typedef struct MPOpts {
char **sub_name;
char **sub_paths;
int sub_auto;
int sub_match_fuzziness;
int osd_bar_visible;
float osd_bar_align_x;
float osd_bar_align_y;

View File

@ -714,7 +714,7 @@ static void open_subtitles_from_options(struct MPContext *mpctx)
for (int i = 0; mpctx->opts->sub_name[i] != NULL; ++i)
mp_add_subtitles(mpctx, mpctx->opts->sub_name[i]);
}
if (mpctx->opts->sub_auto) { // auto load sub file ...
if (mpctx->opts->sub_auto >= 0) { // auto load sub file ...
void *tmp = talloc_new(NULL);
char *base_filename = mpctx->filename;
char *stream_filename = NULL;

View File

@ -156,12 +156,12 @@ static void append_dir_subtitles(struct mpv_global *global,
if (!prio && bstrcmp(tmp_fname_trim, f_fname_trim) == 0)
prio = 3; // matches the movie name
if (!prio && bstr_find(tmp_fname_trim, f_fname_trim) >= 0
&& opts->sub_match_fuzziness >= 1)
&& opts->sub_auto >= 1)
prio = 2; // contains the movie name
if (!prio) {
// doesn't contain the movie name
// don't try in the mplayer subtitle directory
if (!limit_fuzziness && opts->sub_match_fuzziness >= 2) {
if (!limit_fuzziness && opts->sub_auto >= 2) {
prio = 1;
}
}