summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-07-10 12:11:14 +0200
committerwm4 <wm4@nowhere>2015-07-10 12:11:14 +0200
commit4e767826303567f3ccd70c84b462b5dd0c140f6c (patch)
treea304b9bbe8ac708f4d19bfe862ce255cdd9cc649 /player/command.c
parenta46de35abb19810fc0587d7857f63de210e06e40 (diff)
downloadmpv-4e767826303567f3ccd70c84b462b5dd0c140f6c.tar.bz2
mpv-4e767826303567f3ccd70c84b462b5dd0c140f6c.tar.xz
player: refactor chapter seek code
mp_seek_chapter() had only 1 caller. Also the code was rather roundabout; the entire function can be compressed to 5 lines of code. (The new code is functionally the same - "mpctx->last_chapter_seek = -2;" was effectively a dead assingment.)
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/player/command.c b/player/command.c
index fb06cf1b33..c16f804883 100644
--- a/player/command.c
+++ b/player/command.c
@@ -762,7 +762,12 @@ static int mp_property_chapter(void *ctx, struct m_property *prop,
mpctx->stop_play = PT_NEXT_ENTRY;
}
} else {
- mp_seek_chapter(mpctx, chapter);
+ double pts = chapter_start_time(mpctx, chapter);
+ if (pts != MP_NOPTS_VALUE) {
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, pts, MPSEEK_DEFAULT, true);
+ mpctx->last_chapter_seek = chapter;
+ mpctx->last_chapter_pts = pts;
+ }
}
return M_PROPERTY_OK;
}