diff options
author | Tsukasa OMOTO <henry0312@gmail.com> | 2014-06-30 02:27:46 +0900 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-06-29 20:39:49 +0200 |
commit | a73415584c9dbf920ec14d26d0b0629cae81b3d5 (patch) | |
tree | 52e4bb2911b888f97ba5b3d736235494e89311ce /player/command.c | |
parent | 7412257305140e5a21a1acd35f6be546b9295dd5 (diff) | |
download | mpv-a73415584c9dbf920ec14d26d0b0629cae81b3d5.tar.bz2 mpv-a73415584c9dbf920ec14d26d0b0629cae81b3d5.tar.xz |
player: make the time display relative to start PTS
This commit makes the playback start time always at time 0.
Signed-off-by: wm4 <wm4@nowhere>
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}, |