summaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-10-26 22:26:43 +0200
committerwm4 <wm4@nowhere>2017-10-26 22:31:04 +0200
commitf08ec22567f309edb69184558cacb9af6115e985 (patch)
tree41052a82b1b90b6caf1ad13cea5f346a230b0fe0 /misc
parent22fa498bf9968e622e7d6326006c3f321a3bf2e4 (diff)
downloadmpv-f08ec22567f309edb69184558cacb9af6115e985.tar.bz2
mpv-f08ec22567f309edb69184558cacb9af6115e985.tar.xz
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.
Diffstat (limited to 'misc')
-rw-r--r--misc/node.c15
-rw-r--r--misc/node.h3
2 files changed, 18 insertions, 0 deletions
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