From c54c3b6991ac0273e6b7a42dc42c5103f87ff9f1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 18 Jan 2017 17:13:26 +0100 Subject: player: restructure cancel callback As preparation for file prefetching, we basically have to get rid of using mpctx->playback_abort for the main demuxer (i.e. the thing that can be prefetched). It can't be changed on a running demuxer, and always using the same cancel handle would either mean aborting playback would also abort prefetching, or that playback can't be aborted anymore. Make this more flexible with some refactoring. Thi is a quite shitty solution if you ask me, but YOLO. --- input/input.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'input/input.c') diff --git a/input/input.c b/input/input.c index 9525dbcbb1..f0f9f64e9b 100644 --- a/input/input.c +++ b/input/input.c @@ -144,7 +144,8 @@ struct input_ctx { struct cmd_queue cmd_queue; - struct mp_cancel *cancel; + void (*cancel)(void *cancel_ctx); + void *cancel_ctx; void (*wakeup_cb)(void *ctx); void *wakeup_ctx; @@ -809,7 +810,7 @@ int mp_input_queue_cmd(struct input_ctx *ictx, mp_cmd_t *cmd) input_lock(ictx); if (cmd) { if (ictx->cancel && test_abort_cmd(ictx, cmd)) - mp_cancel_trigger(ictx->cancel); + ictx->cancel(ictx->cancel_ctx); queue_add_tail(&ictx->cmd_queue, cmd); mp_input_wakeup(ictx); } @@ -1335,10 +1336,11 @@ void mp_input_uninit(struct input_ctx *ictx) talloc_free(ictx); } -void mp_input_set_cancel(struct input_ctx *ictx, struct mp_cancel *cancel) +void mp_input_set_cancel(struct input_ctx *ictx, void (*cb)(void *c), void *c) { input_lock(ictx); - ictx->cancel = cancel; + ictx->cancel = cb; + ictx->cancel_ctx = c; input_unlock(ictx); } -- cgit v1.2.3