summaryrefslogtreecommitdiffstats
path: root/input/input.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-07 20:44:54 +0200
committerwm4 <wm4@nowhere>2014-09-07 20:44:54 +0200
commitf5af5962378bd40a409716434a6a4d312e50c755 (patch)
tree0d507b7254fbd159a6ca0c29f4c0261c4a4becb4 /input/input.h
parent5546af421f853170ad3142008503bb865a81adef (diff)
downloadmpv-f5af5962378bd40a409716434a6a4d312e50c755.tar.bz2
mpv-f5af5962378bd40a409716434a6a4d312e50c755.tar.xz
player: some more input refactoring
Continues commit 348dfd93. Replace other places where input was manually fetched with common code. demux_was_interrupted() was a weird function; I'm not entirely sure about its original purpose, but now we can just replace it with simpler code as well. One difference is that we always look at the command queue, rather than just when cache initialization failed. Also, instead of discarding all but quit/playlist commands (aka abort command), run all commands. This could possibly lead to unwanted side-effects, like just ignoring commands that have no effect (consider pressing 'f' for fullscreen right on start: since the window is not created yet, it would get discarded). But playlist navigation still works as intended, and some if not all these problems already existed before that in some forms, so it should be ok.
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 431519a47c..6ab1392111 100644
--- a/input/input.h
+++ b/input/input.h
@@ -179,12 +179,8 @@ void mp_input_rm_key_fd(struct input_ctx *ictx, int fd);
// Add a command to the command queue.
int mp_input_queue_cmd(struct input_ctx *ictx, struct mp_cmd *cmd);
-/* Return next available command, or sleep up to "time" ms if none is
- * available. If "peek_only" is true return a reference to the command
- * but leave it queued.
- */
-struct mp_cmd *mp_input_get_cmd(struct input_ctx *ictx, int time,
- int peek_only);
+// Return next queued command, or NULL.
+struct mp_cmd *mp_input_read_cmd(struct input_ctx *ictx);
// Parse text and return corresponding struct mp_cmd.
// The location parameter is for error messages.
@@ -240,6 +236,10 @@ struct input_ctx *mp_input_init(struct mpv_global *global);
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);
+
// Wake up sleeping input loop from another thread.
void mp_input_wakeup(struct input_ctx *ictx);