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.
This commit is contained in:
wm4 2019-05-17 22:40:01 +02:00
parent 455c085538
commit 8a58355a23
1 changed files with 12 additions and 12 deletions

View File

@ -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;
}