summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/input.rst31
-rw-r--r--etc/input.conf10
-rw-r--r--input/cmd_list.c32
-rw-r--r--player/command.c15
4 files changed, 50 insertions, 38 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 8a6ac915ba..badf5ed08a 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -86,11 +86,11 @@ List of Input Commands
disabling default bindings, without disabling all bindings with
``--no-input-default-bindings``.
-``seek <seconds> [relative|absolute|absolute-percent|- [default-precise|exact|keyframes]]``
+``seek <seconds> [relative|absolute|absolute-percent|exact|keyframes]``
Change the playback position. By default, seeks by a relative amount of
seconds.
- The second argument sets the seek mode:
+ The second argument consists of flags controlling the seek mode:
relative (default)
Seek relative to current position (a negative value seeks backwards).
@@ -98,16 +98,19 @@ List of Input Commands
Seek to a given time.
absolute-percent
Seek to a given percent position.
-
- The third argument defines how exact the seek is:
-
- default-precise (default)
- Follow the default behavior as set by ``--hr-seek``, which by default
- does imprecise seeks (like ``keyframes``).
- exact
- Always do exact/hr/precise seeks (slow).
keyframes
Always restart playback at keyframe boundaries (fast).
+ exact
+ Always do exact/hr/precise seeks (slow).
+
+ Multiple flags can be combined, e.g.: ``absolute+keyframes``.
+
+ By default, ``keyframes`` is used for relative seeks, and ``exact`` is used
+ for absolute seeks.
+
+ Before mpv 0.9, the ``keyframes`` and ``exact`` flags had to be passed as
+ 3rd parameter (essentially using a space instead of ``+``). The 3rd
+ parameter is still parsed, but is considered deprecated.
``revert_seek [mode]``
Undoes the ``seek`` command, and some other commands that seek (but not
@@ -170,16 +173,12 @@ List of Input Commands
Save the contents of the mpv window. Typically scaled, with OSD and
subtitles. The exact behavior depends on the selected video output, and
if no support is available, this will act like ``video``.
-
- Second argument:
-
- <single> (default)
- Take a single screenshot.
<each-frame>
Take a screenshot each frame. Issue this command again to stop taking
screenshots. Note that you should disable frame-dropping when using
this mode - or you might receive duplicate images in cases when a
- frame was dropped.
+ frame was dropped. This flag can be combined with the other flags,
+ e.h. ``video+each-frame``.
``screenshot_to_file "<filename>" [subtitles|video|window]``
Take a screenshot and save it to a given file. The format of the file will
diff --git a/etc/input.conf b/etc/input.conf
index 07e2ddeb92..48adfa9035 100644
--- a/etc/input.conf
+++ b/etc/input.conf
@@ -51,10 +51,10 @@
#DOWN seek -60
# Do smaller, always exact (non-keyframe-limited), seeks with shift.
# Don't show them on the OSD (no-osd).
-#Shift+RIGHT no-osd seek 1 - exact
-#Shift+LEFT no-osd seek -1 - exact
-#Shift+UP no-osd seek 5 - exact
-#Shift+DOWN no-osd seek -5 - exact
+#Shift+RIGHT no-osd seek 1 exact
+#Shift+LEFT no-osd seek -1 exact
+#Shift+UP no-osd seek 5 exact
+#Shift+DOWN no-osd seek -5 exact
# Skip to previous/next subtitle (subject to some restrictions; see manpage)
#Ctrl+LEFT no-osd sub_seek -1
#Ctrl+RIGHT no-osd sub_seek 1
@@ -116,7 +116,7 @@
#f cycle fullscreen # toggle fullscreen
#s screenshot # take a screenshot
#S screenshot video # ...without subtitles
-#Alt+s screenshot - each-frame # automatically screenshot every frame
+#Alt+s screenshot each-frame # automatically screenshot every frame
#w add panscan -0.1 # zoom out with -panscan 0 -fs
#e add panscan +0.1 # in
# cycle video aspect ratios; "-1" is the container aspect
diff --git a/input/cmd_list.c b/input/cmd_list.c
index 9eda21b5c9..2c502fd045 100644
--- a/input/cmd_list.c
+++ b/input/cmd_list.c
@@ -51,6 +51,7 @@
#define OARG_DOUBLE(def) OPT_DOUBLE(ARG(d), 0, OPTDEF_DOUBLE(def))
#define OARG_INT(def) OPT_INT(ARG(i), 0, OPTDEF_INT(def))
#define OARG_CHOICE(def, c) OPT_CHOICE(ARG(i), 0, c, OPTDEF_INT(def))
+#define OARG_FLAGS(def, c) OPT_FLAGS(ARG(i), 0, c, OPTDEF_INT(def))
#define OARG_STRING(def) OPT_STRING(ARG(s), 0, OPTDEF_STR(def))
#define OARG_CYCLEDIR(def) OPT_CYCLEDIR(ARG(d), 0, OPTDEF_DOUBLE(def))
@@ -60,17 +61,20 @@ const struct mp_cmd_def mp_cmds[] = {
{ MP_CMD_SEEK, "seek", {
ARG_TIME,
- OARG_CHOICE(0, ({"relative", 0},, {"-", 0},
- {"absolute-percent", 1},
- {"absolute", 2},
- OARG_CHOICE(0, ({"default-precise", 0},
- {"exact", 1},
- {"keyframes", -1})),
+ OARG_FLAGS(4|0, ({"relative", 4|0}, {"-", 4|0},
+ {"absolute-percent", 4|1},
+ {"absolute", 4|2},
+ {"keyframes", 32|8},
+ {"exact", 32|16})),
+ // backwards compatibility only
+ OARG_CHOICE(0, ({"unused", 0}, {"default-precise", 0},
+ {"keyframes", 32|8},
+ {"exact", 32|16})),
},
.allow_auto_repeat = true,
},
{ MP_CMD_REVERT_SEEK, "revert_seek", {
- OARG_CHOICE(0, ({"-", 0}, {"mark", 1})),
+ OARG_FLAGS(0, ({"mark", 1})),
}},
{ MP_CMD_QUIT, "quit", { OARG_INT(0) } },
{ MP_CMD_QUIT_WATCH_LATER, "quit_watch_later", { OARG_INT(0) } },
@@ -79,7 +83,7 @@ const struct mp_cmd_def mp_cmds[] = {
.on_updown = true },
{ MP_CMD_FRAME_BACK_STEP, "frame_back_step", .allow_auto_repeat = true },
{ MP_CMD_PLAYLIST_NEXT, "playlist_next", {
- OARG_CHOICE(0, ({"weak", 0},,
+ OARG_CHOICE(0, ({"weak", 0},
{"force", 1})),
}},
{ MP_CMD_PLAYLIST_PREV, "playlist_prev", {
@@ -102,11 +106,13 @@ const struct mp_cmd_def mp_cmds[] = {
{ MP_CMD_TV_LAST_CHANNEL, "tv_last_channel", },
{ MP_CMD_SCREENSHOT, "screenshot", {
- OARG_CHOICE(2, ({"video", 0},
- {"window", 1},
- {"subtitles", 2}, {"-", 2})),
- OARG_CHOICE(0, ({"single", 0},
- {"each-frame", 1})),
+ OARG_FLAGS(4|2, ({"video", 4|0}, {"-", 4|0},
+ {"window", 4|1},
+ {"subtitles", 4|2},
+ {"each-frame", 8})),
+ // backwards compatibility
+ OARG_CHOICE(0, ({"unused", 0}, {"single", 0},
+ {"each-frame", 8})),
}},
{ MP_CMD_SCREENSHOT_TO_FILE, "screenshot_to_file", {
ARG_STRING,
diff --git a/player/command.c b/player/command.c
index b10ad6a34b..7c0efdc7d7 100644
--- a/player/command.c
+++ b/player/command.c
@@ -4185,8 +4185,12 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd)
switch (cmd->id) {
case MP_CMD_SEEK: {
double v = cmd->args[0].v.d * cmd->scale;
- int abs = cmd->args[1].v.i;
- int exact = cmd->args[2].v.i;
+ int abs = cmd->args[1].v.i & 3;
+ int exact = ((cmd->args[2].v.i | cmd->args[1].v.i) >> 3) & 3;
+ switch (exact) {
+ case 1: exact = -1; break;
+ case 2: exact = 1; break;
+ }
if (!mpctx->num_sources)
return -1;
mark_seek(mpctx);
@@ -4655,9 +4659,12 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd)
break;
}
- case MP_CMD_SCREENSHOT:
- screenshot_request(mpctx, cmd->args[0].v.i, cmd->args[1].v.i, msg_osd);
+ case MP_CMD_SCREENSHOT: {
+ int mode = cmd->args[0].v.i & 3;
+ int freq = (cmd->args[0].v.i | cmd->args[1].v.i) >> 3;
+ screenshot_request(mpctx, mode, freq, msg_osd);
break;
+ }
case MP_CMD_SCREENSHOT_TO_FILE:
screenshot_to_file(mpctx, cmd->args[0].v.s, cmd->args[1].v.i, msg_osd);