summaryrefslogtreecommitdiffstats
path: root/player/command.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-02 01:39:28 +0200
committerwm4 <wm4@nowhere>2014-08-02 01:53:22 +0200
commit733bdebcb94e485317e210cfd79ec058b097e12d (patch)
treebec9b4181e8e9ffdf7d74cabdd12dfad7295f93e /player/command.h
parent82a223e4e0bf45827c20592aaa7d5690593802ff (diff)
downloadmpv-733bdebcb94e485317e210cfd79ec058b097e12d.tar.bz2
mpv-733bdebcb94e485317e210cfd79ec058b097e12d.tar.xz
client API: minor optimizations for property notification
Internally, there are two mechanisms which can trigger property notification as used with "observed" properties in the client API. The first mechanism associates events with a group of properties that are potentially changed by a certain event. mp_event_property_change[] declares these associations, and maps each event to a set of strings. When an event happens, the set of strings is matched against the list of observed properties of each client. Make this more efficient by comparing bitsets of events instead. This way, only a bit-wise "and" is needed for each observed property. Even better, we can completely skip clients which have no observed properties that match. The second mechanism just updates individual properties explicitly by name. Optimize this by using the property index instead. It would be nice if we could reuse the first mechanism for the second one, but there are too many properties to fit into a 64 bit mask. (Though the limit on 64 events might get us into trouble later...)
Diffstat (limited to 'player/command.h')
-rw-r--r--player/command.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/player/command.h b/player/command.h
index 2f9770b714..6e3312b806 100644
--- a/player/command.h
+++ b/player/command.h
@@ -36,6 +36,10 @@ int mp_property_do(const char* name, int action, void* val,
void mp_notify(struct MPContext *mpctx, int event, void *arg);
void mp_notify_property(struct MPContext *mpctx, const char *property);
+int mp_get_property_id(const char *name);
+uint64_t mp_get_property_event_mask(const char *name);
+
+// Must start with the first unused positive value in enum mpv_event_id
#define INTERNAL_EVENT_BASE 24
#define MP_EVENT_CACHE_UPDATE (INTERNAL_EVENT_BASE + 0)