From 07668e50de8c3d9418f7eb1ef00f0391b29a05da Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 25 Sep 2014 20:42:59 +0200 Subject: player: move code to make playloop smaller This is basically a cosmetic change, although it weirdly also affects the percent position in encoding mode. --- player/misc.c | 12 +++++++++--- player/playloop.c | 6 ------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/player/misc.c b/player/misc.c index 51f3e0f863..d5e27f9584 100644 --- a/player/misc.c +++ b/player/misc.c @@ -80,8 +80,9 @@ double rel_time_to_abs(struct MPContext *mpctx, struct m_rel_time t) double get_play_end_pts(struct MPContext *mpctx) { struct MPOpts *opts = mpctx->opts; + double end = MP_NOPTS_VALUE; if (opts->play_end.type) { - return rel_time_to_abs(mpctx, opts->play_end); + end = rel_time_to_abs(mpctx, opts->play_end); } else if (opts->play_length.type) { double startpts = get_start_time(mpctx); double start = rel_time_to_abs(mpctx, opts->play_start); @@ -89,9 +90,14 @@ double get_play_end_pts(struct MPContext *mpctx) start = startpts; double length = rel_time_to_abs(mpctx, opts->play_length); if (start != MP_NOPTS_VALUE && length != MP_NOPTS_VALUE) - return start + length; + end = start + length; } - return MP_NOPTS_VALUE; + if (opts->chapterrange[1] > 0) { + double cend = chapter_start_time(mpctx, opts->chapterrange[1]); + if (cend != MP_NOPTS_VALUE && (end == MP_NOPTS_VALUE || cend < end)) + end = cend; + } + return end; } // Time used to seek external tracks to. diff --git a/player/playloop.c b/player/playloop.c index c9eba1b9c2..de1165e963 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -859,12 +859,6 @@ void run_playloop(struct MPContext *mpctx) } } - if (opts->chapterrange[1] > 0) { - double end = chapter_start_time(mpctx, opts->chapterrange[1]); - if (end != MP_NOPTS_VALUE && (endpts == MP_NOPTS_VALUE || end < endpts)) - endpts = end; - } - handle_cursor_autohide(mpctx); handle_heartbeat_cmd(mpctx); -- cgit v1.2.3