From e0cf983e53afa6a524821265c7547c11f5c79551 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 25 Apr 2014 19:12:24 +0200 Subject: stream: remove interrupt callback global variables This used global variables for the asynchronous interrupt callback. Pick the simple and dumb solution and stuff the callback into mpv_global. Do this because interrupt checking should also work in the connect phase, and currently stream creation equates connecting. Ideally, this would be passed to the stream on creation instead, or connecting would be separated from creation. But since I don't know yet which is better, and since moving stream/demuxer into their own thread is something that will happen later, go with the mpv_global solution. --- player/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'player/main.c') diff --git a/player/main.c b/player/main.c index 1cec6a0324..3522e12b0e 100644 --- a/player/main.c +++ b/player/main.c @@ -347,6 +347,12 @@ struct MPContext *mp_create(void) return mpctx; } +static int check_stream_interrupt(void *ctx) +{ + struct MPContext *mpctx = ctx; + return mp_input_check_interrupt(mpctx->input); +} + static void wakeup_playloop(void *ctx) { struct MPContext *mpctx = ctx; @@ -376,7 +382,8 @@ int mp_initialize(struct MPContext *mpctx) } mpctx->input = mp_input_init(mpctx->global); - stream_set_interrupt_callback(mp_input_check_interrupt, mpctx->input); + mpctx->global->stream_interrupt_cb = check_stream_interrupt; + mpctx->global->stream_interrupt_cb_ctx = mpctx; mp_dispatch_set_wakeup_fn(mpctx->dispatch, wakeup_playloop, mpctx); -- cgit v1.2.3