diff options
author | wm4 <wm4@nowhere> | 2014-10-14 15:54:03 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-10-14 15:54:03 +0200 |
commit | 5bddff6a242b52d95179690a39ce794123e6b6a5 (patch) | |
tree | c5a091a2efbe787b4bfa0aa8b463d09e9b40a430 /player/client.c | |
parent | 596231bc971683f271e9243b9b381c10c4877584 (diff) | |
download | mpv-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.
Diffstat (limited to 'player/client.c')
-rw-r--r-- | player/client.c | 4 |
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; } |