summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-20 17:31:58 +0100
committerwm4 <wm4@nowhere>2014-12-20 17:31:58 +0100
commit7d43a7ea840e752221c0da5cd99e11cf8b3fd834 (patch)
tree5d8a68968fcf0026530c2b7a47bf8f45097f74d4 /player/command.c
parenta69f168dff3ec01833d487b830a06589e5b24e88 (diff)
downloadmpv-7d43a7ea840e752221c0da5cd99e11cf8b3fd834.tar.bz2
mpv-7d43a7ea840e752221c0da5cd99e11cf8b3fd834.tar.xz
player: don't show "0%" percentage in infinite streams
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/player/command.c b/player/command.c
index 52eebe12ec..b4e691c053 100644
--- a/player/command.c
+++ b/player/command.c
@@ -576,10 +576,14 @@ static int mp_property_percent_pos(void *ctx, struct m_property *prop,
.max = 100,
};
return M_PROPERTY_OK;
- case M_PROPERTY_PRINT:
- *(char **)arg = talloc_asprintf(NULL, "%d", get_percent_pos(mpctx));
+ case M_PROPERTY_PRINT: {
+ int pos = get_percent_pos(mpctx);
+ if (pos < 0)
+ return M_PROPERTY_UNAVAILABLE;
+ *(char **)arg = talloc_asprintf(NULL, "%d", pos);
return M_PROPERTY_OK;
}
+ }
return M_PROPERTY_NOT_IMPLEMENTED;
}