summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-09-10 23:47:59 +0200
committerwm4 <wm4@nowhere>2020-09-10 23:47:59 +0200
commit98f9d50b306b6bd11a256d97a33a79acd7d160ec (patch)
treec070eaf9050d474e6b3695c609e9c9c4371d1823
parent4b9d80644d828226675ebeb873e9537ea2eed2b0 (diff)
downloadmpv-98f9d50b306b6bd11a256d97a33a79acd7d160ec.tar.bz2
mpv-98f9d50b306b6bd11a256d97a33a79acd7d160ec.tar.xz
player: some minor code golf
-rw-r--r--player/playloop.c17
1 files changed, 6 insertions, 11 deletions
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);