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/loadfile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'player/loadfile.c') diff --git a/player/loadfile.c b/player/loadfile.c index 5c741369c0..32f41213fd 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -753,7 +753,7 @@ static void transfer_playlist(struct MPContext *mpctx, struct playlist *pl) static int process_open_hooks(struct MPContext *mpctx, char *name) { - mp_hook_run(mpctx, NULL, name); + mp_hook_run(mpctx, name); while (!mp_hook_test_completion(mpctx, name)) { mp_idle(mpctx); @@ -770,7 +770,7 @@ static int process_open_hooks(struct MPContext *mpctx, char *name) static int process_preloaded_hooks(struct MPContext *mpctx) { - mp_hook_run(mpctx, NULL, "on_preloaded"); + mp_hook_run(mpctx, "on_preloaded"); while (!mp_hook_test_completion(mpctx, "on_preloaded")) { mp_idle(mpctx); @@ -783,7 +783,7 @@ static int process_preloaded_hooks(struct MPContext *mpctx) static void process_unload_hooks(struct MPContext *mpctx) { - mp_hook_run(mpctx, NULL, "on_unload"); + mp_hook_run(mpctx, "on_unload"); while (!mp_hook_test_completion(mpctx, "on_unload")) mp_idle(mpctx); -- cgit v1.2.3