summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-14 15:54:03 +0200
committerwm4 <wm4@nowhere>2014-10-14 15:54:03 +0200
commit5bddff6a242b52d95179690a39ce794123e6b6a5 (patch)
treec5a091a2efbe787b4bfa0aa8b463d09e9b40a430
parent596231bc971683f271e9243b9b381c10c4877584 (diff)
downloadmpv-5bddff6a242b52d95179690a39ce794123e6b6a5.tar.bz2
mpv-5bddff6a242b52d95179690a39ce794123e6b6a5.tar.xz
client API: allow returning float properties as integers
I'm starting to think that being type-strict with this interface actually sucks. This commit is a step towards being less strict.
-rw-r--r--player/client.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/player/client.c b/player/client.c
index b7ee01066f..38b0898f86 100644
--- a/player/client.c
+++ b/player/client.c
@@ -723,6 +723,10 @@ static bool conv_node_to_format(void *dst, mpv_format dst_fmt, mpv_node *src)
*(double *)dst = src->u.int64;
return true;
}
+ if (dst_fmt == MPV_FORMAT_INT64 && src->format == MPV_FORMAT_DOUBLE) {
+ if (src->u.double_ >= INT64_MIN && src->u.double_ <= INT64_MAX)
+ *(int64_t *)dst = src->u.double_;
+ }
return false;
}