mirror of
https://github.com/mpv-player/mpv
synced 2025-01-17 20:48:46 +00:00
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.
This commit is contained in:
parent
f360f492d6
commit
7fe56f1602
@ -87,8 +87,8 @@
|
|||||||
:``--afm=ffmpeg``: Try FFmpeg's libavcodec codecs first.
|
:``--afm=ffmpeg``: Try FFmpeg's libavcodec codecs first.
|
||||||
:``--afm=acm,dshow``: Try Win32 codecs first.
|
:``--afm=acm,dshow``: Try Win32 codecs first.
|
||||||
|
|
||||||
--aid=<ID|auto|off>
|
--aid=<ID|auto|no>
|
||||||
Select audio channel. ``auto`` selects the default, ``off`` disables audio.
|
Select audio channel. ``auto`` selects the default, ``no`` disables audio.
|
||||||
See also ``--alang``.
|
See also ``--alang``.
|
||||||
|
|
||||||
--alang=<languagecode[,languagecode,...]>
|
--alang=<languagecode[,languagecode,...]>
|
||||||
@ -789,7 +789,7 @@
|
|||||||
backwards since it has to rewind to the beginning to find an exact frame
|
backwards since it has to rewind to the beginning to find an exact frame
|
||||||
position.
|
position.
|
||||||
|
|
||||||
--hr-seek=<off|absolute|always>
|
--hr-seek=<no|absolute|yes>
|
||||||
Select when to use precise seeks that are not limited to keyframes. Such
|
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
|
seeks require decoding video from the previous keyframe up to the target
|
||||||
position and so can take some time depending on decoding performance. For
|
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 choice to use for seeks; it's possible to explicitly override that
|
||||||
default in the definition of key bindings and in slave mode commands.
|
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
|
: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
|
file, such as a chapter seek, but not for relative seeks like
|
||||||
the default behavior of arrow keys (default).
|
the default behavior of arrow keys (default).
|
||||||
:always: Use precise seeks whenever possible.
|
:yes: Use precise seeks whenever possible.
|
||||||
|
|
||||||
--hr-seek-demuxer-offset=<seconds>
|
--hr-seek-demuxer-offset=<seconds>
|
||||||
This option exists to work around failures to do precise seeks (as in
|
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.
|
*NOTE*: This option is obsolete now that MPlayer has OpenDML support.
|
||||||
|
|
||||||
--loop=<number|inf|off>
|
--loop=<number|inf|no>
|
||||||
Loops playback <number> times. ``inf`` means forever and ``off`` disables
|
Loops playback <number> times. ``inf`` means forever and ``no`` disables
|
||||||
looping.
|
looping.
|
||||||
|
|
||||||
--mc=<seconds/frame>
|
--mc=<seconds/frame>
|
||||||
@ -1694,9 +1694,9 @@
|
|||||||
--shuffle
|
--shuffle
|
||||||
Play files in random order.
|
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
|
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``.
|
See also ``--slang``, ``--vobsubid``, ``--no-sub``.
|
||||||
|
|
||||||
--slang=<languagecode[,languagecode,...]>
|
--slang=<languagecode[,languagecode,...]>
|
||||||
@ -2266,8 +2266,8 @@
|
|||||||
:``--vfm=xanim``:
|
:``--vfm=xanim``:
|
||||||
Try XAnim codecs first.
|
Try XAnim codecs first.
|
||||||
|
|
||||||
--vid=<ID|auto|off>
|
--vid=<ID|auto|no>
|
||||||
Select video channel. ``auto`` selects the default, ``off`` disables video.
|
Select video channel. ``auto`` selects the default, ``no`` disables video.
|
||||||
|
|
||||||
--vm
|
--vm
|
||||||
Try to change to a different video mode. Supported by the x11 and xv video
|
Try to change to a different video mode. Supported by the x11 and xv video
|
||||||
|
@ -333,7 +333,7 @@ const m_option_t common_opts[] = {
|
|||||||
{"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
{"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||||
#endif
|
#endif
|
||||||
OPT_CHOICE("no-config", noconfig, CONF_GLOBAL | CONF_NOCFG | CONF_PRE_PARSE,
|
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 --------------------
|
// ------------------------- stream options --------------------
|
||||||
|
|
||||||
@ -695,7 +695,7 @@ const m_option_t mplayer_opts[]={
|
|||||||
|
|
||||||
OPT_FLAG_CONSTANTS("no-loop", loop_times, 0, 0, -1),
|
OPT_FLAG_CONSTANTS("no-loop", loop_times, 0, 0, -1),
|
||||||
OPT_CHOICE_OR_INT("loop", loop_times, 0, 1, 10000,
|
OPT_CHOICE_OR_INT("loop", loop_times, 0, 1, 10000,
|
||||||
({"off", -1}, {"0", -1},
|
({"no", -1}, {"0", -1},
|
||||||
{"inf", 0})),
|
{"inf", 0})),
|
||||||
|
|
||||||
{"playlist", NULL, CONF_TYPE_STRING, CONF_NOCFG | M_OPT_MIN, 1, 0, NULL},
|
{"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})),
|
({"auto", 0}, {"decoder", 1}, {"sort", 2})),
|
||||||
OPT_MAKE_FLAGS("initial-audio-sync", initial_audio_sync, 0),
|
OPT_MAKE_FLAGS("initial-audio-sync", initial_audio_sync, 0),
|
||||||
OPT_CHOICE("hr-seek", hr_seek, 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_FLOATRANGE("hr-seek-demuxer-offset", hr_seek_demuxer_offset, 0, -9, 99),
|
||||||
OPT_FLAG_CONSTANTS("no-autosync", autosync, 0, 0, -1),
|
OPT_FLAG_CONSTANTS("no-autosync", autosync, 0, 0, -1),
|
||||||
OPT_INTRANGE("autosync", autosync, 0, 0, 10000),
|
OPT_INTRANGE("autosync", autosync, 0, 0, 10000),
|
||||||
@ -722,7 +722,7 @@ const m_option_t mplayer_opts[]={
|
|||||||
OPT_CHOICE("term-osd", term_osd, 0,
|
OPT_CHOICE("term-osd", term_osd, 0,
|
||||||
({"force", 1},
|
({"force", 1},
|
||||||
{"auto", 2}, {"", 2},
|
{"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("term-osd-esc", term_osd_esc, 0, OPTDEF_STR("\x1b[A\r\x1b[K")),
|
||||||
OPT_STRING("playing-msg", playing_msg, 0),
|
OPT_STRING("playing-msg", playing_msg, 0),
|
||||||
|
24
m_option.c
24
m_option.c
@ -91,23 +91,15 @@ static int parse_flag(const m_option_t *opt, struct bstr name,
|
|||||||
struct bstr param, void *dst)
|
struct bstr param, void *dst)
|
||||||
{
|
{
|
||||||
if (param.len) {
|
if (param.len) {
|
||||||
char * const enable[] = { "yes", "on", "ja", "si", "igen", "y", "j",
|
if (!bstrcasecmp0(param, "yes")) {
|
||||||
"i", "tak", "ja", "true", "1" };
|
if (dst)
|
||||||
for (int i = 0; i < sizeof(enable) / sizeof(enable[0]); i++) {
|
VAL(dst) = opt->max;
|
||||||
if (!bstrcasecmp0(param, enable[i])) {
|
return 1;
|
||||||
if (dst)
|
|
||||||
VAL(dst) = opt->max;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
char * const disable[] = { "no", "off", "nein", "nicht", "nem", "n",
|
if (!bstrcasecmp0(param, "no")) {
|
||||||
"nie", "nej", "false", "0" };
|
if (dst)
|
||||||
for (int i = 0; i < sizeof(disable) / sizeof(disable[0]); i++) {
|
VAL(dst) = opt->min;
|
||||||
if (!bstrcasecmp0(param, disable[i])) {
|
return 1;
|
||||||
if (dst)
|
|
||||||
VAL(dst) = opt->min;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mp_msg(MSGT_CFGPARSER, MSGL_ERR,
|
mp_msg(MSGT_CFGPARSER, MSGL_ERR,
|
||||||
"Invalid parameter for %.*s flag: %.*s\n",
|
"Invalid parameter for %.*s flag: %.*s\n",
|
||||||
|
@ -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_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_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.
|
// subconf must have the type struct m_sub_options.
|
||||||
// flagv should be M_OPT_MERGE or M_OPT_FLATTEN.
|
// flagv should be M_OPT_MERGE or M_OPT_FLATTEN.
|
||||||
|
@ -2373,7 +2373,7 @@ int reinit_video_chain(struct MPContext *mpctx)
|
|||||||
&vf_info_ass, NULL
|
&vf_info_ass, NULL
|
||||||
};
|
};
|
||||||
char *vf_arg[] = {
|
char *vf_arg[] = {
|
||||||
"auto", "1", NULL
|
"auto", "yes", NULL
|
||||||
};
|
};
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
struct vf_instance *vf_ass = vf_open_plugin_noerr(opts, libass_vfs,
|
struct vf_instance *vf_ass = vf_open_plugin_noerr(opts, libass_vfs,
|
||||||
|
Loading…
Reference in New Issue
Block a user