summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-03-14 01:32:27 +0100
committerwm4 <wm4@nowhere>2020-03-14 01:32:27 +0100
commit314a4a572bd3a11844314b996268f90b6e722b57 (patch)
tree62e532d20111c4071f2fc22ccdd5dd5a546e3f7a /player/command.c
parent8d965a1bfb3782343a03cff44977f11bb920f0b1 (diff)
downloadmpv-314a4a572bd3a11844314b996268f90b6e722b57.tar.bz2
mpv-314a4a572bd3a11844314b996268f90b6e722b57.tar.xz
command: disable edition switching if there are no editions
Commit 8d965a1bfb3 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?)
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index c4cf6543d8..393966bb77 100644
--- a/player/command.c
+++ b/player/command.c
@@ -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,