diff options
author | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-07-28 22:11:57 +0200 |
---|---|---|
committer | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-07-28 22:11:57 +0200 |
commit | f186aee48b5a600dfbeebd9f38de4becb389de09 (patch) | |
tree | ea015c3b97bd109a884c6eed433b15eefbc28b86 /plugins | |
parent | 9cbbbb83631f77adf9a70f7b63375c81daa26c82 (diff) |
fixed seek backwards switching to next track when seek pos is negative
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/hotkeys/hotkeys.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/hotkeys/hotkeys.c b/plugins/hotkeys/hotkeys.c index dc94e6a3..ed335d6f 100644 --- a/plugins/hotkeys/hotkeys.c +++ b/plugins/hotkeys/hotkeys.c @@ -694,7 +694,12 @@ action_seek_5p_backward_cb (struct DB_plugin_action_s *action, int ctx) { float dur = deadbeef->pl_get_item_duration (it); if (dur > 0) { float pos = deadbeef->streamer_get_playpos (); - deadbeef->sendmessage (DB_EV_SEEK, 0, (pos - dur * 0.05f) * 1000, 0); + pos = (pos - dur * 0.05f) * 1000; + if (pos < 0) { + pos = 0; + } + + deadbeef->sendmessage (DB_EV_SEEK, 0, pos, 0); } deadbeef->pl_item_unref (it); } @@ -726,7 +731,11 @@ action_seek_1p_backward_cb (struct DB_plugin_action_s *action, int ctx) { float dur = deadbeef->pl_get_item_duration (it); if (dur > 0) { float pos = deadbeef->streamer_get_playpos (); - deadbeef->sendmessage (DB_EV_SEEK, 0, (pos - dur * 0.01f) * 1000, 0); + pos = (pos - dur * 0.01f) * 1000; + if (pos < 0) { + pos = 0; + } + deadbeef->sendmessage (DB_EV_SEEK, 0, pos, 0); } deadbeef->pl_item_unref (it); } |