summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorrrooij <rderooij685@gmail.com>2015-05-18 22:56:56 +0200
committerwm4 <wm4@nowhere>2015-05-19 21:33:40 +0200
commite17a8550c408e3ecbe8b1d33dbab694eabe2c713 (patch)
tree9f37b7918f8efe3f991255e464926bbb472d775b /player
parentbe9bf4cc7c1b61a8abcbb3f64386ef10d8aa9f61 (diff)
downloadmpv-e17a8550c408e3ecbe8b1d33dbab694eabe2c713.tar.bz2
mpv-e17a8550c408e3ecbe8b1d33dbab694eabe2c713.tar.xz
input: add relative percentage seek
Only absolute percentage seeking was permitted first. It is now also possible to seek by relative percentage. MPSEEK_FACTOR is used as seek_type. Fixes #1950. Signed-off-by: wm4 <wm4@nowhere>
Diffstat (limited to 'player')
-rw-r--r--player/command.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index c03e63d254..54fc79fede 100644
--- a/player/command.c
+++ b/player/command.c
@@ -4118,6 +4118,11 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re
queue_seek(mpctx, MPSEEK_ABSOLUTE, v, precision, false);
set_osd_function(mpctx,
v > get_current_time(mpctx) ? OSD_FFW : OSD_REW);
+ } else if (abs == 3) { // Relative seeking by percentage
+ queue_seek(mpctx, MPSEEK_FACTOR,
+ get_current_pos_ratio(mpctx, false) + v / 100.0,
+ precision, false);
+ set_osd_function(mpctx, v > 0 ? OSD_FFW : OSD_REW);
} else if (abs) { /* Absolute seek by percentage */
queue_seek(mpctx, MPSEEK_FACTOR, v / 100.0, precision, false);
set_osd_function(mpctx, OSD_FFW); // Direction isn't set correctly