summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-05-17 22:40:01 +0200
committerwm4 <wm4@nowhere>2019-09-19 20:37:04 +0200
commit8a58355a23ec85ff5b33196ccc6d31d660d2805f (patch)
tree8cd46c9bacda2d9a1c4d040d173c8b8431814c47 /player/command.c
parent455c0855388f87de3e358f185835f50fac33d887 (diff)
downloadmpv-8a58355a23ec85ff5b33196ccc6d31d660d2805f.tar.bz2
mpv-8a58355a23ec85ff5b33196ccc6d31d660d2805f.tar.xz
command: put seek ranges at the end of output
This is a minor benign hack that reorders the MPV_FORMAT_NODE output. The order of members is not supposed to matter, but it's how the OSD renders them as raw output. Normally this isn't used, but demuxer-cache-state is a "prominent" case. Moving the seek ranges to the end avoids that the more important other fields are not cut off by going out of the screen on the bottom. Also output the seek ranges in reverse. The order doesn't matter either (as declared by input.rst). Currently, the demuxer orders them by least recent use. Reversing it makes the most recently used range (the current range) show up on top. In other words, this commit does basically nothing but fudge stuff in a cosmetic way to make debugging easier for me, and you've wasted your time reading this commit message and the diff. Good.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/player/command.c b/player/command.c
index dce975dca7..6682398b8b 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1502,18 +1502,6 @@ static int mp_property_demuxer_cache_state(void *ctx, struct m_property *prop,
struct mpv_node *r = (struct mpv_node *)arg;
node_init(r, MPV_FORMAT_NODE_MAP, NULL);
- node_map_add_flag(r, "bof-cached", s.bof_cached);
- node_map_add_flag(r, "eof-cached", s.eof_cached);
-
- struct mpv_node *ranges =
- node_map_add(r, "seekable-ranges", MPV_FORMAT_NODE_ARRAY);
- for (int n = 0; n < s.num_seek_ranges; n++) {
- struct demux_seek_range *range = &s.seek_ranges[n];
- struct mpv_node *sub = node_array_add(ranges, MPV_FORMAT_NODE_MAP);
- node_map_add_double(sub, "start", range->start);
- node_map_add_double(sub, "end", range->end);
- }
-
if (s.ts_end != MP_NOPTS_VALUE)
node_map_add_double(r, "cache-end", s.ts_end);
@@ -1531,6 +1519,18 @@ static int mp_property_demuxer_cache_state(void *ctx, struct m_property *prop,
if (s.ts_last != MP_NOPTS_VALUE)
node_map_add_double(r, "debug-ts-last", s.ts_last);
+ node_map_add_flag(r, "bof-cached", s.bof_cached);
+ node_map_add_flag(r, "eof-cached", s.eof_cached);
+
+ struct mpv_node *ranges =
+ node_map_add(r, "seekable-ranges", MPV_FORMAT_NODE_ARRAY);
+ for (int n = s.num_seek_ranges - 1; n >= 0; n--) {
+ struct demux_seek_range *range = &s.seek_ranges[n];
+ struct mpv_node *sub = node_array_add(ranges, MPV_FORMAT_NODE_MAP);
+ node_map_add_double(sub, "start", range->start);
+ node_map_add_double(sub, "end", range->end);
+ }
+
return M_PROPERTY_OK;
}