summaryrefslogtreecommitdiffstats
path: root/core/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-05-04 00:36:53 +0200
committerwm4 <wm4@nowhere>2013-05-09 01:16:04 +0200
commitde8a53bb7001ac0c0c3480743bb1c6bff45bdb56 (patch)
tree542f134f6a0bec77979e5e83a6e8c4f93cc28d86 /core/command.c
parentc40069a3810e401862386b737c140e3f590afc8d (diff)
downloadmpv-de8a53bb7001ac0c0c3480743bb1c6bff45bdb56.tar.bz2
mpv-de8a53bb7001ac0c0c3480743bb1c6bff45bdb56.tar.xz
core: refactor seek_chapter() function
Makes it easier to understand... maybe. It's still pretty strange how this function may either queue the seek or seek immediately. The way it actually works doesn't change, queuing the seek is just moved into the function. Also add a execute_queued_seek() function, which resets the queue state correctly.
Diffstat (limited to 'core/command.c')
-rw-r--r--core/command.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/core/command.c b/core/command.c
index d44521bf1c..aea8fb2017 100644
--- a/core/command.c
+++ b/core/command.c
@@ -350,14 +350,11 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg,
case M_PROPERTY_SET: ;
int step_all = *(int *)arg - chapter;
chapter += step_all;
- double next_pts = 0;
- queue_seek(mpctx, MPSEEK_NONE, 0, 0);
- chapter = seek_chapter(mpctx, chapter, &next_pts);
- if (chapter >= 0) {
- if (next_pts > -1.0)
- queue_seek(mpctx, MPSEEK_ABSOLUTE, next_pts, 0);
- } else if (step_all > 0)
+ if (chapter >= get_chapter_count(mpctx) && step_all > 0) {
mpctx->stop_play = PT_NEXT_ENTRY;
+ } else {
+ mp_seek_chapter(mpctx, chapter);
+ }
return M_PROPERTY_OK;
}
return M_PROPERTY_NOT_IMPLEMENTED;