From f08ec22567f309edb69184558cacb9af6115e985 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 26 Oct 2017 22:26:43 +0200 Subject: command: change demuxer-cache-state property to return multiple ranges Even if the demuxer cache does not multiple ranges yet. This is to reduce the pain should caching of multiple ranges ever be implemented. Also change it from the sub properties stuff to return a mpv_node directly, which is less roundabout. Sub-property access won't work anymore, though. Remove the seekable-start/-end fields as well, as they're redundant with the ranges. All this would normally be considered an API change, but since it's been only a few days with no known users, change it immediately. This adds some node.c helpers as well, as the code would be too damn fugly otherwise. --- misc/node.c | 15 +++++++++++++++ misc/node.h | 3 +++ 2 files changed, 18 insertions(+) (limited to 'misc') diff --git a/misc/node.c b/misc/node.c index 1ea8ea7da5..73e95e61b0 100644 --- a/misc/node.c +++ b/misc/node.c @@ -63,3 +63,18 @@ void node_map_add_string(struct mpv_node *dst, const char *key, const char *val) entry->format = MPV_FORMAT_STRING; entry->u.string = talloc_strdup(dst->u.list, val); } + +void node_map_add_int64(struct mpv_node *dst, const char *key, int64_t v) +{ + node_map_add(dst, key, MPV_FORMAT_INT64)->u.int64 = v; +} + +void node_map_add_double(struct mpv_node *dst, const char *key, double v) +{ + node_map_add(dst, key, MPV_FORMAT_DOUBLE)->u.double_ = v; +} + +void node_map_add_flag(struct mpv_node *dst, const char *key, bool v) +{ + node_map_add(dst, key, MPV_FORMAT_FLAG)->u.flag = v; +} diff --git a/misc/node.h b/misc/node.h index c3b4501dc8..a1bdab0ae1 100644 --- a/misc/node.h +++ b/misc/node.h @@ -7,5 +7,8 @@ void node_init(struct mpv_node *dst, int format, struct mpv_node *parent); struct mpv_node *node_array_add(struct mpv_node *dst, int format); struct mpv_node *node_map_add(struct mpv_node *dst, const char *key, int format); void node_map_add_string(struct mpv_node *dst, const char *key, const char *val); +void node_map_add_int64(struct mpv_node *dst, const char *key, int64_t v); +void node_map_add_double(struct mpv_node *dst, const char *key, double v); +void node_map_add_flag(struct mpv_node *dst, const char *key, bool v); #endif -- cgit v1.2.3