diff options
Diffstat (limited to 'player/command.c')
-rw-r--r-- | player/command.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/player/command.c b/player/command.c index 6538d5e2bb..6edb9115d3 100644 --- a/player/command.c +++ b/player/command.c @@ -462,10 +462,9 @@ static int mp_property_time_pos(void *ctx, struct m_property *prop, static bool time_remaining(MPContext *mpctx, double *remaining) { double len = get_time_length(mpctx); - double pos = get_current_time(mpctx); - double start = get_start_time(mpctx); + double playback = get_playback_time(mpctx); - *remaining = len - (pos - start); + *remaining = len - playback; return len > 0; } @@ -492,6 +491,16 @@ static int mp_property_playtime_remaining(void *ctx, struct m_property *prop, return property_time(action, arg, remaining / speed); } +static int mp_property_playback_time(void *ctx, struct m_property *prop, + int action, void *arg) +{ + MPContext *mpctx = ctx; + if (!mpctx->num_sources) + return M_PROPERTY_UNAVAILABLE; + + return property_time(action, arg, get_playback_time(mpctx)); +} + /// Current BD/DVD title (RW) static int mp_property_disc_title(void *ctx, struct m_property *prop, int action, void *arg) @@ -2594,6 +2603,7 @@ static const struct m_property mp_properties[] = { {"time-pos", mp_property_time_pos}, {"time-remaining", mp_property_remaining}, {"playtime-remaining", mp_property_playtime_remaining}, + {"playback-time", mp_property_playback_time}, {"disc-title", mp_property_disc_title}, {"disc-menu-active", mp_property_disc_menu}, {"chapter", mp_property_chapter}, |