mirror of https://github.com/mpv-player/mpv
input: accept input command prefixes in any order
This is more consistent, and doesn't bother the user with ordering rules when new prefixes are added. Will break obscure uses of legacy commands: if the command is supposed to be translated by the legacy command bridge, and if that command uses one of the pausing* prefixes, the command can't be parsed. Well, just use the new commands in this case.
This commit is contained in:
parent
b0a60b7321
commit
3e6ec6dfa5
|
@ -794,16 +794,6 @@ mp_cmd_t *mp_input_parse_cmd(bstr str, const char *loc)
|
||||||
bstr start = str;
|
bstr start = str;
|
||||||
void *tmp = talloc_new(NULL);
|
void *tmp = talloc_new(NULL);
|
||||||
|
|
||||||
if (eat_token(&str, "pausing")) {
|
|
||||||
pausing = 1;
|
|
||||||
} else if (eat_token(&str, "pausing_keep")) {
|
|
||||||
pausing = 2;
|
|
||||||
} else if (eat_token(&str, "pausing_toggle")) {
|
|
||||||
pausing = 3;
|
|
||||||
} else if (eat_token(&str, "pausing_keep_force")) {
|
|
||||||
pausing = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
str = bstr_lstrip(str);
|
str = bstr_lstrip(str);
|
||||||
for (const struct legacy_cmd *entry = legacy_cmds; entry->old; entry++) {
|
for (const struct legacy_cmd *entry = legacy_cmds; entry->old; entry++) {
|
||||||
size_t old_len = strlen(entry->old);
|
size_t old_len = strlen(entry->old);
|
||||||
|
@ -820,16 +810,28 @@ mp_cmd_t *mp_input_parse_cmd(bstr str, const char *loc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eat_token(&str, "no-osd")) {
|
while (1) {
|
||||||
on_osd = MP_ON_OSD_NO;
|
if (eat_token(&str, "pausing")) {
|
||||||
} else if (eat_token(&str, "osd-bar")) {
|
pausing = 1;
|
||||||
on_osd = MP_ON_OSD_BAR;
|
} else if (eat_token(&str, "pausing_keep")) {
|
||||||
} else if (eat_token(&str, "osd-msg")) {
|
pausing = 2;
|
||||||
on_osd = MP_ON_OSD_MSG;
|
} else if (eat_token(&str, "pausing_toggle")) {
|
||||||
} else if (eat_token(&str, "osd-msg-bar")) {
|
pausing = 3;
|
||||||
on_osd = MP_ON_OSD_MSG | MP_ON_OSD_BAR;
|
} else if (eat_token(&str, "pausing_keep_force")) {
|
||||||
} else if (eat_token(&str, "osd-auto")) {
|
pausing = 4;
|
||||||
// default
|
} else if (eat_token(&str, "no-osd")) {
|
||||||
|
on_osd = MP_ON_OSD_NO;
|
||||||
|
} else if (eat_token(&str, "osd-bar")) {
|
||||||
|
on_osd = MP_ON_OSD_BAR;
|
||||||
|
} else if (eat_token(&str, "osd-msg")) {
|
||||||
|
on_osd = MP_ON_OSD_MSG;
|
||||||
|
} else if (eat_token(&str, "osd-msg-bar")) {
|
||||||
|
on_osd = MP_ON_OSD_MSG | MP_ON_OSD_BAR;
|
||||||
|
} else if (eat_token(&str, "osd-auto")) {
|
||||||
|
// default
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmd_idx = 0;
|
int cmd_idx = 0;
|
||||||
|
|
Loading…
Reference in New Issue