summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-09-18 15:50:24 +0200
committerwm4 <wm4@nowhere>2012-09-23 14:58:21 +0200
commit7fe56f16026d6b2440e879078f8848a5056f1da8 (patch)
treeeefc51ce3dc65e000bbc8290f50e60889c35ab7f
parentf360f492d6c73197890eeb86759d417b23b52452 (diff)
downloadmpv-7fe56f16026d6b2440e879078f8848a5056f1da8.tar.bz2
mpv-7fe56f16026d6b2440e879078f8848a5056f1da8.tar.xz
options: accept "yes" and "no" only for flags
This removes the alternative values like "off", "0", "false" etc., and also the non-English versions of these. This is done for general consistency. It's better to have a single way of doing things when multiple ways don't add singificant value. Also update some choices for consistency.
-rw-r--r--DOCS/man/en/options.rst22
-rw-r--r--cfg-mplayer.h8
-rw-r--r--m_option.c24
-rw-r--r--m_option.h2
-rw-r--r--mplayer.c2
5 files changed, 25 insertions, 33 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index 653cac9737..c52c8b307e 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -87,8 +87,8 @@
:``--afm=ffmpeg``: Try FFmpeg's libavcodec codecs first.
:``--afm=acm,dshow``: Try Win32 codecs first.
---aid=<ID|auto|off>
- Select audio channel. ``auto`` selects the default, ``off`` disables audio.
+--aid=<ID|auto|no>
+ Select audio channel. ``auto`` selects the default, ``no`` disables audio.
See also ``--alang``.
--alang=<languagecode[,languagecode,...]>
@@ -789,7 +789,7 @@
backwards since it has to rewind to the beginning to find an exact frame
position.
---hr-seek=<off|absolute|always>
+--hr-seek=<no|absolute|yes>
Select when to use precise seeks that are not limited to keyframes. Such
seeks require decoding video from the previous keyframe up to the target
position and so can take some time depending on decoding performance. For
@@ -797,11 +797,11 @@
default choice to use for seeks; it's possible to explicitly override that
default in the definition of key bindings and in slave mode commands.
- :off: Never use precise seeks.
+ :no: Never use precise seeks.
:absolute: Use precise seeks if the seek is to an absolute position in the
file, such as a chapter seek, but not for relative seeks like
the default behavior of arrow keys (default).
- :always: Use precise seeks whenever possible.
+ :yes: Use precise seeks whenever possible.
--hr-seek-demuxer-offset=<seconds>
This option exists to work around failures to do precise seeks (as in
@@ -1139,8 +1139,8 @@
*NOTE*: This option is obsolete now that MPlayer has OpenDML support.
---loop=<number|inf|off>
- Loops playback <number> times. ``inf`` means forever and ``off`` disables
+--loop=<number|inf|no>
+ Loops playback <number> times. ``inf`` means forever and ``no`` disables
looping.
--mc=<seconds/frame>
@@ -1694,9 +1694,9 @@
--shuffle
Play files in random order.
---sid=<ID|auto|off>
+--sid=<ID|auto|no>
Display the subtitle stream specified by <ID> (0-31). ``auto`` selects the
- default, ``off`` disables subtitles.
+ default, ``no`` disables subtitles.
See also ``--slang``, ``--vobsubid``, ``--no-sub``.
--slang=<languagecode[,languagecode,...]>
@@ -2266,8 +2266,8 @@
:``--vfm=xanim``:
Try XAnim codecs first.
---vid=<ID|auto|off>
- Select video channel. ``auto`` selects the default, ``off`` disables video.
+--vid=<ID|auto|no>
+ Select video channel. ``auto`` selects the default, ``no`` disables video.
--vm
Try to change to a different video mode. Supported by the x11 and xv video
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index a6b8e93647..775963a879 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -333,7 +333,7 @@ const m_option_t common_opts[] = {
{"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL},
#endif
OPT_CHOICE("no-config", noconfig, CONF_GLOBAL | CONF_NOCFG | CONF_PRE_PARSE,
- ({"off", 0}, {"user", 1}, {"system", 2}, {"all", 3})),
+ ({"no", 0}, {"user", 1}, {"system", 2}, {"all", 3})),
// ------------------------- stream options --------------------
@@ -695,7 +695,7 @@ const m_option_t mplayer_opts[]={
OPT_FLAG_CONSTANTS("no-loop", loop_times, 0, 0, -1),
OPT_CHOICE_OR_INT("loop", loop_times, 0, 1, 10000,
- ({"off", -1}, {"0", -1},
+ ({"no", -1}, {"0", -1},
{"inf", 0})),
{"playlist", NULL, CONF_TYPE_STRING, CONF_NOCFG | M_OPT_MIN, 1, 0, NULL},
@@ -712,7 +712,7 @@ const m_option_t mplayer_opts[]={
({"auto", 0}, {"decoder", 1}, {"sort", 2})),
OPT_MAKE_FLAGS("initial-audio-sync", initial_audio_sync, 0),
OPT_CHOICE("hr-seek", hr_seek, 0,
- ({"off", -1}, {"absolute", 0}, {"always", 1}, {"on", 1})),
+ ({"no", -1}, {"absolute", 0}, {"always", 1}, {"yes", 1})),
OPT_FLOATRANGE("hr-seek-demuxer-offset", hr_seek_demuxer_offset, 0, -9, 99),
OPT_FLAG_CONSTANTS("no-autosync", autosync, 0, 0, -1),
OPT_INTRANGE("autosync", autosync, 0, 0, 10000),
@@ -722,7 +722,7 @@ const m_option_t mplayer_opts[]={
OPT_CHOICE("term-osd", term_osd, 0,
({"force", 1},
{"auto", 2}, {"", 2},
- {"off", 0})),
+ {"no", 0})),
OPT_STRING("term-osd-esc", term_osd_esc, 0, OPTDEF_STR("\x1b[A\r\x1b[K")),
OPT_STRING("playing-msg", playing_msg, 0),
diff --git a/m_option.c b/m_option.c
index 2f8daa42de..1fef1fd86e 100644
--- a/m_option.c
+++ b/m_option.c
@@ -91,23 +91,15 @@ static int parse_flag(const m_option_t *opt, struct bstr name,
struct bstr param, void *dst)
{
if (param.len) {
- char * const enable[] = { "yes", "on", "ja", "si", "igen", "y", "j",
- "i", "tak", "ja", "true", "1" };
- for (int i = 0; i < sizeof(enable) / sizeof(enable[0]); i++) {
- if (!bstrcasecmp0(param, enable[i])) {
- if (dst)
- VAL(dst) = opt->max;
- return 1;
- }
+ if (!bstrcasecmp0(param, "yes")) {
+ if (dst)
+ VAL(dst) = opt->max;
+ return 1;
}
- char * const disable[] = { "no", "off", "nein", "nicht", "nem", "n",
- "nie", "nej", "false", "0" };
- for (int i = 0; i < sizeof(disable) / sizeof(disable[0]); i++) {
- if (!bstrcasecmp0(param, disable[i])) {
- if (dst)
- VAL(dst) = opt->min;
- return 1;
- }
+ if (!bstrcasecmp0(param, "no")) {
+ if (dst)
+ VAL(dst) = opt->min;
+ return 1;
}
mp_msg(MSGT_CFGPARSER, MSGL_ERR,
"Invalid parameter for %.*s flag: %.*s\n",
diff --git a/m_option.h b/m_option.h
index bb5f7da304..f05fe17bd4 100644
--- a/m_option.h
+++ b/m_option.h
@@ -472,7 +472,7 @@ static inline void m_option_free(const m_option_t *opt, void *dst)
#define OPT_CHOICE_OR_INT_(optname, varname, flags, minval, maxval, choices, ...) OPT_GENERAL(optname, varname, (flags) | CONF_RANGE, .min = minval, .max = maxval, .priv = (void *)&(const struct m_opt_choice_alternatives[]){OPT_HELPER_REMOVEPAREN choices, {NULL}}, __VA_ARGS__)
#define OPT_TIME(...) OPT_GENERAL(__VA_ARGS__, .type = &m_option_type_time)
-#define OPT_TRACKCHOICE(name, var) OPT_CHOICE_OR_INT(name, var, 0, 0, 8190, ({"off", -2}, {"no", -2}, {"auto", -1}))
+#define OPT_TRACKCHOICE(name, var) OPT_CHOICE_OR_INT(name, var, 0, 0, 8190, ({"no", -2}, {"auto", -1}))
// subconf must have the type struct m_sub_options.
// flagv should be M_OPT_MERGE or M_OPT_FLATTEN.
diff --git a/mplayer.c b/mplayer.c
index d4865831e7..d17be7c357 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -2373,7 +2373,7 @@ int reinit_video_chain(struct MPContext *mpctx)
&vf_info_ass, NULL
};
char *vf_arg[] = {
- "auto", "1", NULL
+ "auto", "yes", NULL
};
int retcode = 0;
struct vf_instance *vf_ass = vf_open_plugin_noerr(opts, libass_vfs,