From f60826c3a14ba3b49077f17e5364b7347f9b468a Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 23 Mar 2018 16:24:49 +0100 Subject: client API: add a first class hook API, and deprecate old API As it turns out, there are multiple libmpv users who saw a need to use the hook API. The API is kind of shitty and was never meant to be actually public (it was mostly a hack for the ytdl script). Introduce a proper API and deprecate the old one. The old one will probably continue to work for a few releases, but will be removed eventually. There are some slight changes to the old API, but if a user followed the manual properly, it won't break. Mostly untested. Appears to work with ytdl_hook. --- player/command.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'player/command.h') diff --git a/player/command.h b/player/command.h index 478bc8c737..2a102ddfbe 100644 --- a/player/command.h +++ b/player/command.h @@ -50,7 +50,7 @@ uint64_t mp_get_property_event_mask(const char *name); enum { // Must start with the first unused positive value in enum mpv_event_id // MPV_EVENT_* and MP_EVENT_* must not overlap. - INTERNAL_EVENT_BASE = 25, + INTERNAL_EVENT_BASE = 26, MP_EVENT_CHANGE_ALL, MP_EVENT_CACHE_UPDATE, MP_EVENT_WIN_RESIZE, @@ -61,7 +61,10 @@ enum { }; bool mp_hook_test_completion(struct MPContext *mpctx, char *type); -void mp_hook_run(struct MPContext *mpctx, char *client, char *type); +void mp_hook_run(struct MPContext *mpctx, char *type); +int mp_hook_continue(struct MPContext *mpctx, char *client, uint64_t id); +void mp_hook_add(struct MPContext *mpctx, const char *client, const char *name, + uint64_t user_id, int pri, bool legacy); void mark_seek(struct MPContext *mpctx); -- cgit v1.2.3