summaryrefslogtreecommitdiffstats
path: root/mpvcore/player/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'mpvcore/player/command.c')
-rw-r--r--mpvcore/player/command.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/mpvcore/player/command.c b/mpvcore/player/command.c
index 1b8ae9c95b..e36675bf05 100644
--- a/mpvcore/player/command.c
+++ b/mpvcore/player/command.c
@@ -382,22 +382,22 @@ static int mp_property_time_pos(m_option_t *prop, int action,
return property_time(prop, action, arg, get_current_time(mpctx));
}
-static double time_remaining(MPContext *mpctx, double *len)
+static bool time_remaining(MPContext *mpctx, double *remaining)
{
- *len = get_time_length(mpctx);
+ double len = get_time_length(mpctx);
double pos = get_current_time(mpctx);
double start = get_start_time(mpctx);
- return *len - (pos - start);
+ *remaining = len - (pos - start);
+
+ return !!(int)len;
}
static int mp_property_remaining(m_option_t *prop, int action,
void *arg, MPContext *mpctx)
{
- double len;
- double remaining = time_remaining(mpctx, &len);
-
- if (!(int)len)
+ double remaining;
+ if (!time_remaining(mpctx, &remaining))
return M_PROPERTY_UNAVAILABLE;
return property_time(prop, action, arg, remaining);
@@ -406,10 +406,8 @@ static int mp_property_remaining(m_option_t *prop, int action,
static int mp_property_playtime_remaining(m_option_t *prop, int action,
void *arg, MPContext *mpctx)
{
- double len;
- double remaining = time_remaining(mpctx, &len);
-
- if (!(int)len)
+ double remaining;
+ if (!time_remaining(mpctx, &remaining))
return M_PROPERTY_UNAVAILABLE;
double speed = mpctx->opts->playback_speed;