summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-05-19 18:44:03 +0200
committerwm4 <wm4@nowhere>2018-05-24 19:56:35 +0200
commitb3968ecf05c11cf42c8120be3a1d716c4cc71b5d (patch)
tree63001fbaf2769ff7435d0794df0ee7f8c718f497 /input
parentdbcd654e612ca32673cf2703758b05700cb87d03 (diff)
downloadmpv-b3968ecf05c11cf42c8120be3a1d716c4cc71b5d.tar.bz2
mpv-b3968ecf05c11cf42c8120be3a1d716c4cc71b5d.tar.xz
input: remove now unused "abort command" and cancel infrastructure
The previous commit removed all uses.
Diffstat (limited to 'input')
-rw-r--r--input/cmd.c28
-rw-r--r--input/cmd.h7
-rw-r--r--input/input.c33
-rw-r--r--input/input.h4
4 files changed, 2 insertions, 70 deletions
diff --git a/input/cmd.c b/input/cmd.c
index 0a6bd73931..f0bb53e040 100644
--- a/input/cmd.c
+++ b/input/cmd.c
@@ -552,34 +552,6 @@ void mp_cmd_dump(struct mp_log *log, int msgl, char *header, struct mp_cmd *cmd)
mp_msg(log, msgl, "]\n");
}
-// 0: no, 1: maybe, 2: sure
-static int is_abort_cmd(struct mp_cmd *cmd)
-{
- if (cmd->def->is_abort)
- return 2;
- if (cmd->def->is_soft_abort)
- return 1;
- if (cmd->def == &mp_cmd_list) {
- int r = 0;
- for (struct mp_cmd *sub = cmd->args[0].v.p; sub; sub = sub->queue_next) {
- int x = is_abort_cmd(sub);
- r = MPMAX(r, x);
- }
- return r;
- }
- return 0;
-}
-
-bool mp_input_is_maybe_abort_cmd(struct mp_cmd *cmd)
-{
- return is_abort_cmd(cmd) >= 1;
-}
-
-bool mp_input_is_abort_cmd(struct mp_cmd *cmd)
-{
- return is_abort_cmd(cmd) >= 2;
-}
-
bool mp_input_is_repeatable_cmd(struct mp_cmd *cmd)
{
return (cmd->def->allow_auto_repeat) || cmd->def == &mp_cmd_list ||
diff --git a/input/cmd.h b/input/cmd.h
index a2cbaae510..2d9c922230 100644
--- a/input/cmd.h
+++ b/input/cmd.h
@@ -39,8 +39,6 @@ struct mp_cmd_def {
bool on_updown; // always emit it on both up and down key events
bool vararg; // last argument can be given 0 to multiple times
bool scalable;
- bool is_abort;
- bool is_soft_abort;
bool is_ignore;
bool default_async; // default to MP_ASYNC flag if none set by user
// If you set this, handler() must ensure mp_cmd_ctx_complete() is called
@@ -121,11 +119,6 @@ typedef struct mp_cmd {
extern const struct mp_cmd_def mp_cmds[];
extern const struct mp_cmd_def mp_cmd_list;
-// Executing this command will maybe abort playback (play something else, or quit).
-bool mp_input_is_maybe_abort_cmd(struct mp_cmd *cmd);
-// This command will definitely abort playback.
-bool mp_input_is_abort_cmd(struct mp_cmd *cmd);
-
bool mp_input_is_repeatable_cmd(struct mp_cmd *cmd);
bool mp_input_is_scalable_cmd(struct mp_cmd *cmd);
diff --git a/input/input.c b/input/input.c
index 20c39dd4ac..c8f1a64ad5 100644
--- a/input/input.c
+++ b/input/input.c
@@ -153,9 +153,6 @@ struct input_ctx {
struct cmd_queue cmd_queue;
- void (*cancel)(void *cancel_ctx);
- void *cancel_ctx;
-
void (*wakeup_cb)(void *ctx);
void *wakeup_ctx;
};
@@ -531,13 +528,11 @@ static void release_down_cmd(struct input_ctx *ictx, bool drop_current)
}
// We don't want the append to the command queue indefinitely, because that
-// could lead to situations where recovery would take too long. On the other
-// hand, don't drop commands that will abort playback.
+// could lead to situations where recovery would take too long.
static bool should_drop_cmd(struct input_ctx *ictx, struct mp_cmd *cmd)
{
struct cmd_queue *queue = &ictx->cmd_queue;
- return queue_count_cmds(queue) >= ictx->opts->key_fifo_size &&
- !mp_input_is_abort_cmd(cmd);
+ return queue_count_cmds(queue) >= ictx->opts->key_fifo_size;
}
static struct mp_cmd *resolve_key(struct input_ctx *ictx, int code)
@@ -883,26 +878,10 @@ static void adjust_max_wait_time(struct input_ctx *ictx, double *time)
}
}
-static bool test_abort_cmd(struct input_ctx *ictx, struct mp_cmd *new)
-{
- if (!mp_input_is_maybe_abort_cmd(new))
- return false;
- if (mp_input_is_abort_cmd(new))
- return true;
- // Abort only if there are going to be at least 2 commands in the queue.
- for (struct mp_cmd *cmd = ictx->cmd_queue.first; cmd; cmd = cmd->queue_next) {
- if (mp_input_is_maybe_abort_cmd(cmd))
- return true;
- }
- return false;
-}
-
int mp_input_queue_cmd(struct input_ctx *ictx, mp_cmd_t *cmd)
{
input_lock(ictx);
if (cmd) {
- if (ictx->cancel && test_abort_cmd(ictx, cmd))
- ictx->cancel(ictx->cancel_ctx);
queue_add_tail(&ictx->cmd_queue, cmd);
mp_input_wakeup(ictx);
}
@@ -1423,14 +1402,6 @@ void mp_input_uninit(struct input_ctx *ictx)
talloc_free(ictx);
}
-void mp_input_set_cancel(struct input_ctx *ictx, void (*cb)(void *c), void *c)
-{
- input_lock(ictx);
- ictx->cancel = cb;
- ictx->cancel_ctx = c;
- input_unlock(ictx);
-}
-
bool mp_input_use_alt_gr(struct input_ctx *ictx)
{
input_lock(ictx);
diff --git a/input/input.h b/input/input.h
index 1641f9fad6..ff194785c9 100644
--- a/input/input.h
+++ b/input/input.h
@@ -193,10 +193,6 @@ 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);
-// Used to asynchronously abort playback. Needed because the core still can
-// block on network in some situations.
-void mp_input_set_cancel(struct input_ctx *ictx, void (*cb)(void *c), void *c);
-
// If this returns true, use Right Alt key as Alt Gr to produce special
// characters. If false, count Right Alt as the modifier Alt key.
bool mp_input_use_alt_gr(struct input_ctx *ictx);