diff options
author | wm4 <wm4@nowhere> | 2013-12-16 20:12:53 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-12-16 20:14:43 +0100 |
commit | 9662e3e50922d2cef486a657655bdc5c8786d033 (patch) | |
tree | ed615e972c5337d4cd3a1fa0cea1aae868653054 | |
parent | 908dfa7949fb7666ac84513189448d96ea0e4be4 (diff) | |
download | mpv-9662e3e50922d2cef486a657655bdc5c8786d033.tar.bz2 mpv-9662e3e50922d2cef486a657655bdc5c8786d033.tar.xz |
command: mess with previous commit
Nothing actually used the returned length. Since the remaining time can
easily become 0 or negative (e.g. incorrectly estimated file duration),
the time_remaining function still needs 2 return values, though.
-rw-r--r-- | mpvcore/player/command.c | 20 |
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; |