summaryrefslogtreecommitdiffstats
path: root/input/input.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-16 14:25:50 +0200
committerwm4 <wm4@nowhere>2016-09-16 14:49:23 +0200
commit8716c2e88f9694cf8368132e50a0e778dc055dd1 (patch)
treefde808300704d664eef1c19a8115de9bcc00cec3 /input/input.h
parent15baf2789cd5c5e0413616df22f235478f40e65e (diff)
downloadmpv-8716c2e88f9694cf8368132e50a0e778dc055dd1.tar.bz2
mpv-8716c2e88f9694cf8368132e50a0e778dc055dd1.tar.xz
player: use better way to wait for input and dispatching commands
Instead of using input_ctx for waiting, use the dispatch queue directly. One big change is that the dispatch queue will just process commands that come in (e.g. from client API) without returning. This should reduce unnecessary playloop excutions (which is good since the playloop got a bit fat from rechecking a lot of conditions every iteration). Since this doesn't force a new playloop iteration on every access, this has to be enforced manually in some cases. Normal input (via terminal or VO window) still wakes up the playloop every time, though that's not too important. It makes testing this harder, though. If there are missing wakeup calls, it will be noticed only when using the client API in some form. At this point we could probably use a normal lock instead of the dispatch queue stuff.
Diffstat (limited to 'input/input.h')
-rw-r--r--input/input.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/input/input.h b/input/input.h
index a5710b6065..cc523efc62 100644
--- a/input/input.h
+++ b/input/input.h
@@ -219,22 +219,22 @@ bool mp_input_test_dragging(struct input_ctx *ictx, int x, int y);
// Initialize the input system
struct mpv_global;
-struct input_ctx *mp_input_init(struct mpv_global *global);
+struct input_ctx *mp_input_init(struct mpv_global *global,
+ void (*wakeup_cb)(void *ctx),
+ void *wakeup_ctx);
// Load config, options, and devices.
void mp_input_load(struct input_ctx *ictx);
void mp_input_uninit(struct input_ctx *ictx);
-// Sleep for the given amount of seconds, until mp_input_wakeup() is called,
-// or new input arrives. seconds<=0 returns immediately.
-void mp_input_wait(struct input_ctx *ictx, double seconds);
+// Return number of seconds until the next autorepeat event will be generated.
+// Returns INFINITY if no autorepeated key is active.
+double mp_input_get_delay(struct input_ctx *ictx);
// Wake up sleeping input loop from another thread.
void mp_input_wakeup(struct input_ctx *ictx);
-void mp_input_wakeup_nolock(struct input_ctx *ictx);
-
// Used to asynchronously abort playback. Needed because the core still can
// block on network in some situations.
struct mp_cancel;