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. --- player/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'player/main.c') diff --git a/player/main.c b/player/main.c index 3a07e0f539..8f54b98728 100644 --- a/player/main.c +++ b/player/main.c @@ -311,6 +311,12 @@ static int cfg_include(void *ctx, char *filename, int flags) return r; } +static void abort_playback_cb(void *ctx) +{ + struct MPContext *mpctx = ctx; + mp_abort_playback_async(mpctx); +} + struct MPContext *mp_create(void) { char *enable_talloc = getenv("MPV_LEAK_REPORT"); @@ -361,7 +367,7 @@ struct MPContext *mp_create(void) cocoa_set_input_context(mpctx->input); #endif - mp_input_set_cancel(mpctx->input, mpctx->playback_abort); + mp_input_set_cancel(mpctx->input, abort_playback_cb, mpctx); char *verbose_env = getenv("MPV_VERBOSE"); if (verbose_env) -- cgit v1.2.3