summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-01-15 22:24:56 +0100
committerwm4 <wm4@nowhere>2014-01-15 22:25:14 +0100
commit5655038a9510aaf2ae6f5172ba4964c2172d1ee2 (patch)
tree9f4463f69b116ba72aee9e21ae7e02f0c14690cc /player
parent80c11eba66811e37722b7a59a93f21a516cc689d (diff)
downloadmpv-5655038a9510aaf2ae6f5172ba4964c2172d1ee2.tar.bz2
mpv-5655038a9510aaf2ae6f5172ba4964c2172d1ee2.tar.xz
command: if playback position is unknown, make percent-pos unavailable
Before that, it just returned -1. The print case is inconsistent with that, but I'll leave it for now, because it's consistent with status line / show_progress behavior.
Diffstat (limited to 'player')
-rw-r--r--player/command.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/player/command.c b/player/command.c
index 6ee50dea87..9761c33176 100644
--- a/player/command.c
+++ b/player/command.c
@@ -353,13 +353,18 @@ static int mp_property_percent_pos(m_option_t *prop, int action,
return M_PROPERTY_UNAVAILABLE;
switch (action) {
- case M_PROPERTY_SET: ;
+ case M_PROPERTY_SET: {
double pos = *(double *)arg;
queue_seek(mpctx, MPSEEK_FACTOR, pos / 100.0, 0);
return M_PROPERTY_OK;
- case M_PROPERTY_GET:
- *(double *)arg = get_current_pos_ratio(mpctx, false) * 100.0;
+ }
+ case M_PROPERTY_GET: {
+ double pos = get_current_pos_ratio(mpctx, false) * 100.0;
+ if (pos < 0)
+ return M_PROPERTY_UNAVAILABLE;
+ *(double *)arg = pos;
return M_PROPERTY_OK;
+ }
case M_PROPERTY_PRINT:
*(char **)arg = talloc_asprintf(NULL, "%d", get_percent_pos(mpctx));
return M_PROPERTY_OK;