From 98f9d50b306b6bd11a256d97a33a79acd7d160ec Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 10 Sep 2020 23:47:59 +0200 Subject: player: some minor code golf --- player/playloop.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'player') diff --git a/player/playloop.c b/player/playloop.c index 0c78ca5940..d36eed2090 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -507,24 +507,19 @@ double get_start_time(struct MPContext *mpctx, int dir) double get_current_time(struct MPContext *mpctx) { - struct demuxer *demuxer = mpctx->demuxer; - if (demuxer) { - if (mpctx->playback_pts != MP_NOPTS_VALUE) - return mpctx->playback_pts * mpctx->play_dir; - if (mpctx->last_seek_pts != MP_NOPTS_VALUE) - return mpctx->last_seek_pts; - } - return MP_NOPTS_VALUE; + if (!mpctx->demuxer) + return MP_NOPTS_VALUE; + if (mpctx->playback_pts != MP_NOPTS_VALUE) + return mpctx->playback_pts * mpctx->play_dir; + return mpctx->last_seek_pts; } double get_playback_time(struct MPContext *mpctx) { double cur = get_current_time(mpctx); - if (cur == MP_NOPTS_VALUE) - return cur; // During seeking, the time corresponds to the last seek time - apply some // cosmetics to it. - if (mpctx->playback_pts == MP_NOPTS_VALUE) { + if (cur != MP_NOPTS_VALUE && mpctx->playback_pts == MP_NOPTS_VALUE) { double length = get_time_length(mpctx); if (length >= 0) cur = MPCLAMP(cur, 0, length); -- cgit v1.2.3