summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
Diffstat (limited to 'player')
-rw-r--r--player/loadfile.c10
-rw-r--r--player/playloop.c6
2 files changed, 8 insertions, 8 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index ea33e46aee..948142fb45 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -1335,17 +1335,17 @@ goto_reopen_demuxer: ;
if (startpos == -1 && mpctx->resolve_result &&
mpctx->resolve_result->start_time > 0)
startpos = mpctx->resolve_result->start_time;
+ if (startpos == -1 && opts->chapterrange[0] > 0) {
+ double start = chapter_start_time(mpctx, opts->chapterrange[0] - 1);
+ if (start != MP_NOPTS_VALUE)
+ startpos = start;
+ }
if (startpos == -1 && mpctx->timeline)
startpos = 0;
if (startpos != -1) {
queue_seek(mpctx, MPSEEK_ABSOLUTE, startpos, 0, true);
execute_queued_seek(mpctx);
}
- if (opts->chapterrange[0] > 0) {
- if (mp_seek_chapter(mpctx, opts->chapterrange[0] - 1))
- execute_queued_seek(mpctx);
- }
-
get_relative_time(mpctx); // reset current delta
if (mpctx->opts->pause)
diff --git a/player/playloop.c b/player/playloop.c
index 6121c7367c..bbcc9a3df7 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -947,9 +947,9 @@ void run_playloop(struct MPContext *mpctx)
}
if (opts->chapterrange[1] > 0) {
- int cur_chapter = get_current_chapter(mpctx);
- if (cur_chapter != -1 && cur_chapter + 1 > opts->chapterrange[1])
- mpctx->stop_play = PT_NEXT_ENTRY;
+ double end = chapter_start_time(mpctx, opts->chapterrange[1]);
+ if (end != MP_NOPTS_VALUE && (endpts == MP_NOPTS_VALUE || end < endpts))
+ endpts = end;
}
if (mpctx->d_audio && !mpctx->restart_playback && !ao_untimed(mpctx->ao)) {