From de8a53bb7001ac0c0c3480743bb1c6bff45bdb56 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 4 May 2013 00:36:53 +0200 Subject: 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. --- core/command.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'core/command.c') 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; -- cgit v1.2.3