summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-25 19:12:24 +0200
committerwm4 <wm4@nowhere>2014-04-25 19:12:24 +0200
commite0cf983e53afa6a524821265c7547c11f5c79551 (patch)
tree4ea1c5f0b17464e6b503c23be14b935cba0090d4 /player
parent3d51ef3dc83ea59a47c0eccf4ae93ae2a441ceb7 (diff)
downloadmpv-e0cf983e53afa6a524821265c7547c11f5c79551.tar.bz2
mpv-e0cf983e53afa6a524821265c7547c11f5c79551.tar.xz
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.
Diffstat (limited to 'player')
-rw-r--r--player/main.c9
1 files changed, 8 insertions, 1 deletions
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);