From 5bddff6a242b52d95179690a39ce794123e6b6a5 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 14 Oct 2014 15:54:03 +0200 Subject: 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. --- player/client.c | 4 ++++ 1 file changed, 4 insertions(+) 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; } -- cgit v1.2.3