summaryrefslogtreecommitdiffstats
path: root/mpvcore
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-09-02 01:09:52 +0200
committerwm4 <wm4@nowhere>2013-09-08 01:49:57 +0200
commit5f00c3cf20c10ad4a9ae403550b18f35d9317df5 (patch)
tree13ba7cfbe5548afa802576567e9b43854e9a9e81 /mpvcore
parentdd67b32acda9ccb000603cbb6a9a5a501fb3db05 (diff)
downloadmpv-5f00c3cf20c10ad4a9ae403550b18f35d9317df5.tar.bz2
mpv-5f00c3cf20c10ad4a9ae403550b18f35d9317df5.tar.xz
input: remove separation between key and control queue
This is actually quite useless. It also allows the control queue to starve the key queue, because the control queue is always checked first.
Diffstat (limited to 'mpvcore')
-rw-r--r--mpvcore/input/input.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/mpvcore/input/input.c b/mpvcore/input/input.c
index f935b17bbf..a35c315ae5 100644
--- a/mpvcore/input/input.c
+++ b/mpvcore/input/input.c
@@ -570,8 +570,7 @@ struct input_ctx {
struct input_fd fds[MP_MAX_FDS];
unsigned int num_fds;
- struct cmd_queue key_cmd_queue;
- struct cmd_queue control_cmd_queue;
+ struct cmd_queue cmd_queue;
int wakeup_pipe[2];
};
@@ -1414,7 +1413,7 @@ static void release_down_cmd(struct input_ctx *ictx)
{
if (ictx->current_down_cmd && ictx->current_down_cmd->key_up_follows) {
ictx->current_down_cmd->key_up_follows = false;
- queue_add(&ictx->key_cmd_queue, ictx->current_down_cmd, false);
+ queue_add(&ictx->cmd_queue, ictx->current_down_cmd, false);
} else {
talloc_free(ictx->current_down_cmd);
}
@@ -1551,7 +1550,7 @@ static mp_cmd_t *check_autorepeat(struct input_ctx *ictx)
static void add_key_cmd(struct input_ctx *ictx, struct mp_cmd *cmd)
{
- struct cmd_queue *queue = &ictx->key_cmd_queue;
+ struct cmd_queue *queue = &ictx->cmd_queue;
if (queue_count_cmds(queue) >= ictx->key_fifo_size &&
(!mp_input_is_abort_cmd(cmd->id) || queue_has_abort_cmds(queue)))
{
@@ -1676,7 +1675,7 @@ static void read_cmd_fd(struct input_ctx *ictx, struct input_fd *cmd_fd)
struct mp_cmd *cmd = mp_input_parse_cmd(bstr0(text), "<pipe>");
talloc_free(text);
if (cmd)
- queue_add(&ictx->control_cmd_queue, cmd, false);
+ queue_add(&ictx->cmd_queue, cmd, false);
if (!cmd_fd->got_cmd)
return;
}
@@ -1817,7 +1816,7 @@ int mp_input_queue_cmd(struct input_ctx *ictx, mp_cmd_t *cmd)
input_lock(ictx);
ictx->got_new_events = true;
if (cmd)
- queue_add(&ictx->control_cmd_queue, cmd, false);
+ queue_add(&ictx->cmd_queue, cmd, false);
input_unlock(ictx);
return 1;
}
@@ -1831,15 +1830,13 @@ mp_cmd_t *mp_input_get_cmd(struct input_ctx *ictx, int time, int peek_only)
input_lock(ictx);
if (async_quit_request) {
struct mp_cmd *cmd = mp_input_parse_cmd(bstr0("quit 1"), "");
- queue_add(&ictx->control_cmd_queue, cmd, true);
+ queue_add(&ictx->cmd_queue, cmd, true);
}
- if (ictx->control_cmd_queue.first || ictx->key_cmd_queue.first)
+ if (ictx->cmd_queue.first)
time = 0;
read_all_events(ictx, time);
- struct cmd_queue *queue = &ictx->control_cmd_queue;
- if (!queue->first)
- queue = &ictx->key_cmd_queue;
+ struct cmd_queue *queue = &ictx->cmd_queue;
if (!queue->first) {
struct mp_cmd *repeated = check_autorepeat(ictx);
if (repeated)
@@ -2366,8 +2363,7 @@ void mp_input_uninit(struct input_ctx *ictx)
if (ictx->wakeup_pipe[i] != -1)
close(ictx->wakeup_pipe[i]);
}
- clear_queue(&ictx->key_cmd_queue);
- clear_queue(&ictx->control_cmd_queue);
+ clear_queue(&ictx->cmd_queue);
talloc_free(ictx->current_down_cmd);
input_destroy(ictx);
talloc_free(ictx);
@@ -2410,9 +2406,7 @@ void mp_input_wakeup(struct input_ctx *ictx)
static bool test_abort(struct input_ctx *ictx)
{
- if (async_quit_request || queue_has_abort_cmds(&ictx->key_cmd_queue) ||
- queue_has_abort_cmds(&ictx->control_cmd_queue))
- {
+ if (async_quit_request || queue_has_abort_cmds(&ictx->cmd_queue)) {
mp_tmsg(MSGT_INPUT, MSGL_WARN, "Received command to move to "
"another file. Aborting current processing.\n");
return true;