summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-08 21:24:14 +0200
committerwm4 <wm4@nowhere>2014-04-08 21:24:14 +0200
commitd6022f33d64df9c0226db49bef68197473bfc598 (patch)
tree43df5777976b20276720d2dbb6d1cd28eb449455 /player
parenta94020e25bc5fc50ac0cea132a4cccb7743e85fa (diff)
downloadmpv-d6022f33d64df9c0226db49bef68197473bfc598.tar.bz2
mpv-d6022f33d64df9c0226db49bef68197473bfc598.tar.xz
command: property set commands should send property change notifications
Some of these property implementations already send notifications on their own, but most don't. This takes care of them. Of course this still doesn't handle all propertry changes - this is impossible without special-casing each property that can change on its own.
Diffstat (limited to 'player')
-rw-r--r--player/command.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/player/command.c b/player/command.c
index 127ef1e42d..9921a055f5 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2301,10 +2301,30 @@ const struct m_option *mp_get_property_list(void)
return mp_properties;
}
+static bool is_property_set(int action, void *val)
+{
+ switch (action) {
+ case M_PROPERTY_SET:
+ case M_PROPERTY_SWITCH:
+ case M_PROPERTY_SET_STRING:
+ case M_PROPERTY_SET_NODE:
+ return true;
+ case M_PROPERTY_KEY_ACTION: {
+ struct m_property_action_arg *key = val;
+ return is_property_set(key->action, key->arg);
+ }
+ default:
+ return false;
+ }
+}
+
int mp_property_do(const char *name, int action, void *val,
struct MPContext *ctx)
{
- return m_property_do(ctx->log, mp_properties, name, action, val, ctx);
+ int r = m_property_do(ctx->log, mp_properties, name, action, val, ctx);
+ if (r == M_PROPERTY_OK && is_property_set(action, val))
+ mp_notify_property(ctx, (char *)name);
+ return r;
}
char *mp_property_expand_string(struct MPContext *mpctx, const char *str)