summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-09-22 06:15:36 +0200
committerwm4 <wm4@nowhere>2012-10-12 10:10:31 +0200
commit45b432f4c32be5cab798a0658d9461b3a40a6d94 (patch)
tree3a460173adb5e79a648f1b04fb39d73ba4d6a721 /input
parent9939776e5ee70818d9cc4a5a7cd9f09da4239164 (diff)
downloadmpv-45b432f4c32be5cab798a0658d9461b3a40a6d94.tar.bz2
mpv-45b432f4c32be5cab798a0658d9461b3a40a6d94.tar.xz
commands: replace "switch" with "add" and "cycle"
Now it depends on the command whether a property wraps around, or stops at min/max valid property value. For practically all properties, it's quite unambiguous what the "switch" command should have done, and there's technically no need to replace it with these new commands. More over, most properties that cycle are boolean anyway. But it seems more orthogonal to make the difference explicit, rather than hardcoding it. Having different commands also makes it more explicit to the user what these commands do, both just due to the naming, and what wrapping policy is used. The code is simpler too.
Diffstat (limited to 'input')
-rw-r--r--input/input.c71
-rw-r--r--input/input.h3
2 files changed, 38 insertions, 36 deletions
diff --git a/input/input.c b/input/input.c
index d3ad18075d..6c3e0d709f 100644
--- a/input/input.c
+++ b/input/input.c
@@ -135,7 +135,8 @@ static const mp_cmd_t mp_cmds[] = {
{ MP_CMD_KEYDOWN_EVENTS, "key_down_event", { ARG_INT } },
{ MP_CMD_SET, "set", { ARG_STRING, ARG_STRING } },
{ MP_CMD_GET_PROPERTY, "get_property", { ARG_STRING } },
- { MP_CMD_SWITCH, "switch", { ARG_STRING, OARG_FLOAT(0) } },
+ { MP_CMD_ADD, "add", { ARG_STRING, OARG_FLOAT(0) } },
+ { MP_CMD_CYCLE, "cycle", { ARG_STRING, OARG_FLOAT(0) } },
{ MP_CMD_SET_MOUSE_POS, "set_mouse_pos", { ARG_INT, ARG_INT } },
@@ -158,40 +159,40 @@ struct legacy_cmd {
const char *old, *new;
};
static const struct legacy_cmd legacy_cmds[] = {
- {"loop", "switch loop"},
- {"seek_chapter", "switch chapter"},
- {"switch_angle", "switch angle"},
- {"pause", "switch pause"},
- {"volume", "switch volume"},
- {"mute", "switch mute"},
- {"audio_delay", "switch audio-delay"},
- {"switch_audio", "switch audio"},
- {"balance", "switch balance"},
- {"vo_fullscreen", "no-osd switch fullscreen"},
- {"panscan", "switch panscan"},
- {"vo_ontop", "switch ontop"},
- {"vo_rootwin", "switch rootwin"},
- {"vo_border", "switch border"},
- {"frame_drop", "switch framedrop"},
- {"gamma", "switch gamma"},
- {"brightness", "switch brightness"},
- {"contrast", "switch contrast"},
- {"saturation", "switch saturation"},
- {"hue", "switch hue"},
- {"switch_vsync", "switch vsync"},
- {"sub_select", "switch sub"},
- {"sub_pos", "switch sub-pos"},
- {"sub_delay", "switch sub-delay"},
- {"sub_visibility", "switch sub-visibility"},
- {"forced_subs_only", "switch sub-forced-only"},
- {"sub_scale", "switch sub-scale"},
- {"ass_use_margins", "switch ass-use-margins"},
- {"tv_set_brightness", "switch tv-brightness"},
- {"tv_set_hue", "switch tv-hue"},
- {"tv_set_saturation", "switch tv-saturation"},
- {"tv_set_contrast", "switch tv-contrast"},
- {"step_property_osd", "switch"},
- {"step_property", "no-osd switch"},
+ {"loop", "cycle loop"},
+ {"seek_chapter", "add chapter"},
+ {"switch_angle", "cycle angle"},
+ {"pause", "cycle pause"},
+ {"volume", "add volume"},
+ {"mute", "cycle mute"},
+ {"audio_delay", "add audio-delay"},
+ {"switch_audio", "cycle audio"},
+ {"balance", "add balance"},
+ {"vo_fullscreen", "no-osd cycle fullscreen"},
+ {"panscan", "add panscan"},
+ {"vo_ontop", "cycle ontop"},
+ {"vo_rootwin", "cycle rootwin"},
+ {"vo_border", "cycle border"},
+ {"frame_drop", "cycle framedrop"},
+ {"gamma", "add gamma"},
+ {"brightness", "add brightness"},
+ {"contrast", "add contrast"},
+ {"saturation", "add saturation"},
+ {"hue", "add hue"},
+ {"switch_vsync", "cycle vsync"},
+ {"sub_select", "cycle sub"},
+ {"sub_pos", "add sub-pos"},
+ {"sub_delay", "add sub-delay"},
+ {"sub_visibility", "cycle sub-visibility"},
+ {"forced_subs_only", "cycle sub-forced-only"},
+ {"sub_scale", "add sub-scale"},
+ {"ass_use_margins", "cycle ass-use-margins"},
+ {"tv_set_brightness", "add tv-brightness"},
+ {"tv_set_hue", "add tv-hue"},
+ {"tv_set_saturation", "add tv-saturation"},
+ {"tv_set_contrast", "add tv-contrast"},
+ {"step_property_osd", "cycle"},
+ {"step_property", "no-osd cycle"},
{"set_property", "no-osd set"},
{"set_property_osd", "set"},
{"speed_set", "set speed"},
diff --git a/input/input.h b/input/input.h
index 158d71b8ac..d3abc6f4c8 100644
--- a/input/input.h
+++ b/input/input.h
@@ -54,7 +54,8 @@ enum mp_command_type {
MP_CMD_RADIO_SET_CHANNEL,
MP_CMD_RADIO_SET_FREQ,
MP_CMD_SET_MOUSE_POS,
- MP_CMD_SWITCH,
+ MP_CMD_ADD,
+ MP_CMD_CYCLE,
MP_CMD_RADIO_STEP_FREQ,
MP_CMD_TV_STEP_FREQ,
MP_CMD_TV_START_SCAN,