summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-23 20:49:08 +0200
committerwm4 <wm4@nowhere>2016-09-23 20:49:08 +0200
commitf4db6b8479e52476f3ee35d9f6153e251b498462 (patch)
tree578491f8fc9eb17f9d1fe3c6fc7b3eb6b8f98338
parent5f2822d5024d6de03b947cf081336ce329e3b15b (diff)
downloadmpv-f4db6b8479e52476f3ee35d9f6153e251b498462.tar.bz2
mpv-f4db6b8479e52476f3ee35d9f6153e251b498462.tar.xz
command: make most options observable
The property observation mechanism turns properties into integer IDs for fast comparison. This means if two properties get the same ID, they will receive the same notifications. Use this to make properties under options/ receive notifications. The option-property bridge marks top-level properties with the same name as the options. This still might not work in cases the C code sets values on options structs directly.
-rw-r--r--player/command.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index afc556e3eb..eae3f7116e 100644
--- a/player/command.c
+++ b/player/command.c
@@ -4032,6 +4032,12 @@ static bool match_property(const char *a, const char *b)
{
if (strcmp(a, "*") == 0)
return true;
+ // Give options and properties the same ID each, so change notifications
+ // work both way.
+ if (strncmp(a, "options/", 8) == 0)
+ a += 8;
+ if (strncmp(b, "options/", 8) == 0)
+ b += 8;
int len_a = prefix_len(a);
int len_b = prefix_len(b);
return strncmp(a, b, MPMIN(len_a, len_b)) == 0;