mirror of
https://github.com/mpv-player/mpv
synced 2024-12-23 15:22:09 +00:00
command: disable edition switching if there are no editions
Commit 8d965a1bfb
changed option/property min/max handling. As a
consequence, ranges that contain only 1 or 0 elements are not possible
anymore. Normally that's fine, because it makes no sense to have an
option that has only one or none allowed value (statically).
But edition switching used some sort of mechanism where the property can
return a different, dynamically decided range at runtime. That meant
that if there were <2 editions, edition switching with the "cycle"
command would always pick the same value. But with the recent commit,
this changed to having "no range set" and would cycle through all
integer values.
Work this around with a simple change. Now, edition switching on a file
without editions shows "edition: auto" instead of "edition: 0", which
may appear odd. But the former is the --edition default value, and
previous mpv versions rendered the edition property like this when not
using switching.
(Who the fuck uses editions?)
This commit is contained in:
parent
8d965a1bfb
commit
314a4a572b
@ -159,7 +159,8 @@ int m_property_do(struct mp_log *log, const struct m_property *prop_list,
|
||||
return r;
|
||||
}
|
||||
case M_PROPERTY_GET_CONSTRICTED_TYPE: {
|
||||
if ((r = do_action(prop_list, name, action, arg, ctx)) >= 0)
|
||||
r = do_action(prop_list, name, action, arg, ctx);
|
||||
if (r >= 0 || r == M_PROPERTY_UNAVAILABLE)
|
||||
return r;
|
||||
if ((r = do_action(prop_list, name, M_PROPERTY_GET_TYPE, arg, ctx)) >= 0)
|
||||
return r;
|
||||
|
@ -1045,6 +1045,8 @@ static int mp_property_edition(void *ctx, struct m_property *prop,
|
||||
struct demuxer *demuxer = mpctx->demuxer;
|
||||
|
||||
if (action == M_PROPERTY_GET_CONSTRICTED_TYPE && demuxer) {
|
||||
if (demuxer->num_editions <= 1)
|
||||
return M_PROPERTY_UNAVAILABLE;
|
||||
*(struct m_option *)arg = (struct m_option){
|
||||
.type = CONF_TYPE_INT,
|
||||
.min = 0,
|
||||
|
Loading…
Reference in New Issue
Block a user