From b79f291f4bb6f3f2efb24b9f03829784c17a0541 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 20 Oct 2014 23:43:10 +0200 Subject: command: remove hook cancellation mechanism I doubt anyone will actually use this correctly. Also, there was a bug (a typo) which prevented it from working at all. --- player/command.c | 12 +----------- player/command.h | 1 - player/loadfile.c | 5 ++--- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/player/command.c b/player/command.c index b73e5e863c..2e42c8079f 100644 --- a/player/command.c +++ b/player/command.c @@ -128,7 +128,7 @@ static bool send_hook_msg(struct MPContext *mpctx, struct hook_handler *h, { mpv_event_client_message *m = talloc_ptrtype(NULL, m); *m = (mpv_event_client_message){0}; - MP_TARRAY_APPEND(m, m->args, m->num_args, "hook_run"); + MP_TARRAY_APPEND(m, m->args, m->num_args, cmd); MP_TARRAY_APPEND(m, m->args, m->num_args, talloc_strdup(m, h->user_id)); MP_TARRAY_APPEND(m, m->args, m->num_args, talloc_strdup(m, h->type)); bool r = @@ -163,16 +163,6 @@ void mp_hook_run(struct MPContext *mpctx, char *client, char *type) send_hook_msg(mpctx, next, "hook_run"); } -void mp_hook_abort(struct MPContext *mpctx, char *type) -{ - struct command_ctx *cmd = mpctx->command_ctx; - for (int n = 0; n < cmd->num_hooks; n++) { - struct hook_handler *h = cmd->hooks[n]; - if (h->active && strcmp(h->type, type) == 0) - send_hook_msg(mpctx, h, "hook_abort"); - } -} - static int compare_hook(const void *pa, const void *pb) { struct hook_handler **h1 = (void *)pa; diff --git a/player/command.h b/player/command.h index f9bb7c49a0..0307bd06b7 100644 --- a/player/command.h +++ b/player/command.h @@ -45,6 +45,5 @@ uint64_t mp_get_property_event_mask(const char *name); bool mp_hook_test_completion(struct MPContext *mpctx, char *type); void mp_hook_run(struct MPContext *mpctx, char *client, char *type); -void mp_hook_abort(struct MPContext *mpctx, char *type); #endif /* MPLAYER_COMMAND_H */ diff --git a/player/loadfile.c b/player/loadfile.c index f448389754..470e0d24eb 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -802,11 +802,10 @@ static int process_open_hooks(struct MPContext *mpctx) while (!mp_hook_test_completion(mpctx, "on_load")) { mp_idle(mpctx); if (mpctx->stop_play) { - if (mpctx->stop_play == PT_QUIT) - return -1; // Can't exit immediately, the script would interfere with the // next file being loaded. - mp_hook_abort(mpctx, "on_load"); + if (mpctx->stop_play == PT_QUIT) + return -1; } } -- cgit v1.2.3