summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-10-16 16:16:10 +0200
committerwm4 <wm4@nowhere>2015-10-16 16:16:10 +0200
commit8d414e2fe7f79f1bbf9158e8aa034e9ac9cf2222 (patch)
tree6c5d512e3d79f882e8a5b16599f91b02109cfb6c /player/command.c
parent2483dab54d77288db218030910f6b1b4b08292e5 (diff)
downloadmpv-8d414e2fe7f79f1bbf9158e8aa034e9ac9cf2222.tar.bz2
mpv-8d414e2fe7f79f1bbf9158e8aa034e9ac9cf2222.tar.xz
command: make time properties unavailable if timestamp is unknown
Let's hope this doesn't confuse client API users too much. It's still the best solution to get rid of corner cases where it actually return the wrong timestamp on start, and then suddenly jump.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 0b19b20b6c..1bcf0c47e3 100644
--- a/player/command.c
+++ b/player/command.c
@@ -484,6 +484,9 @@ static int mp_property_stream_end(void *ctx, struct m_property *prop,
// Assumes prop is the type of the actual property.
static int property_time(int action, void *arg, double time)
{
+ if (time == MP_NOPTS_VALUE)
+ return M_PROPERTY_UNAVAILABLE;
+
const struct m_option time_type = {.type = CONF_TYPE_TIME};
switch (action) {
case M_PROPERTY_GET:
@@ -652,6 +655,9 @@ static bool time_remaining(MPContext *mpctx, double *remaining)
double len = get_time_length(mpctx);
double playback = get_playback_time(mpctx);
+ if (playback == MP_NOPTS_VALUE)
+ return false;
+
*remaining = len - playback;
return len >= 0;