From 94441ed13963356fa25f7e52a12e36387220ebba Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 4 May 2014 10:31:24 +0200 Subject: options: merge ---sub-auto-match with --sub-auto There's no reason why these should be separate. --- DOCS/man/en/changes.rst | 2 +- DOCS/man/en/options.rst | 15 ++++++--------- options/options.c | 7 +++---- options/options.h | 1 - player/loadfile.c | 2 +- sub/find_subfiles.c | 4 ++-- 6 files changed, 13 insertions(+), 18 deletions(-) diff --git a/DOCS/man/en/changes.rst b/DOCS/man/en/changes.rst index e06f779ec9..9e059b360c 100644 --- a/DOCS/man/en/changes.rst +++ b/DOCS/man/en/changes.rst @@ -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`` diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst index bb8f58968c..bb178ce448 100644 --- a/DOCS/man/en/options.rst +++ b/DOCS/man/en/options.rst @@ -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-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=`` - 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=`` Specify extra directories to search for subtitles matching the video. Multiple directories can be separated by ":" (";" on Windows). diff --git a/options/options.c b/options/options.c index 21a2f4014d..e589bf8d61 100644 --- a/options/options.c +++ b/options/options.c @@ -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, diff --git a/options/options.h b/options/options.h index 2ceaa02965..da16422ff1 100644 --- a/options/options.h +++ b/options/options.h @@ -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; diff --git a/player/loadfile.c b/player/loadfile.c index 6319d092ce..e460c0ac69 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -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; diff --git a/sub/find_subfiles.c b/sub/find_subfiles.c index 5efbd20476..2d03300eaf 100644 --- a/sub/find_subfiles.c +++ b/sub/find_subfiles.c @@ -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; } } -- cgit v1.2.3