summaryrefslogtreecommitdiffstats
path: root/input/input.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-26 22:00:25 +0200
committerwm4 <wm4@nowhere>2015-05-26 22:00:25 +0200
commit39a339c813ee3bb7f8e1f65dcf325e7f0db110a2 (patch)
tree29019398afa88404be4919bfc7917e9007999611 /input/input.c
parent51654d2ad54712599bc6c0b1141e0d0b7a9f6959 (diff)
downloadmpv-39a339c813ee3bb7f8e1f65dcf325e7f0db110a2.tar.bz2
mpv-39a339c813ee3bb7f8e1f65dcf325e7f0db110a2.tar.xz
input: remove some unneeded things
Wakeup FDs are not needed anymore (this code exists only for libwaio usage by now), and 2 other functions can be made private.
Diffstat (limited to 'input/input.c')
-rw-r--r--input/input.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/input/input.c b/input/input.c
index 29d5b7831e..2063a45923 100644
--- a/input/input.c
+++ b/input/input.c
@@ -1331,7 +1331,6 @@ void mp_input_run_cmd(struct input_ctx *ictx, const char **cmd)
struct mp_input_src_internal {
pthread_t thread;
bool thread_running;
- int wakeup[2];
bool init_done;
char *cmd_buffer;
@@ -1339,7 +1338,7 @@ struct mp_input_src_internal {
bool drop;
};
-struct mp_input_src *mp_input_add_src(struct input_ctx *ictx)
+static struct mp_input_src *mp_input_add_src(struct input_ctx *ictx)
{
input_lock(ictx);
if (ictx->num_sources == MP_MAX_SOURCES) {
@@ -1354,10 +1353,7 @@ struct mp_input_src *mp_input_add_src(struct input_ctx *ictx)
.global = ictx->global,
.log = mp_log_new(src, ictx->log, name),
.input_ctx = ictx,
- .in = talloc(src, struct mp_input_src_internal),
- };
- *src->in = (struct mp_input_src_internal){
- .wakeup = {-1, -1},
+ .in = talloc_zero(src, struct mp_input_src_internal),
};
ictx->sources[ictx->num_sources++] = src;
@@ -1366,6 +1362,8 @@ struct mp_input_src *mp_input_add_src(struct input_ctx *ictx)
return src;
}
+static void mp_input_src_kill(struct mp_input_src *src);
+
static void close_input_sources(struct input_ctx *ictx)
{
// To avoid lock-order issues, we first remove each source from the context,
@@ -1380,7 +1378,7 @@ static void close_input_sources(struct input_ctx *ictx)
}
}
-void mp_input_src_kill(struct mp_input_src *src)
+static void mp_input_src_kill(struct mp_input_src *src)
{
if (!src)
return;
@@ -1390,7 +1388,6 @@ void mp_input_src_kill(struct mp_input_src *src)
if (ictx->sources[n] == src) {
MP_TARRAY_REMOVE_AT(ictx->sources, ictx->num_sources, n);
input_unlock(ictx);
- write(src->in->wakeup[1], &(char){0}, 1);
if (src->cancel)
src->cancel(src);
if (src->in->thread_running)
@@ -1439,14 +1436,6 @@ int mp_input_add_thread_src(struct input_ctx *ictx, void *ctx,
if (!src)
return -1;
-#ifndef __MINGW32__
- // Always create for convenience.
- if (mp_make_wakeup_pipe(src->in->wakeup) < 0) {
- mp_input_src_kill(src);
- return -1;
- }
-#endif
-
void *args[] = {src, loop_fn, ctx};
if (pthread_create(&src->in->thread, NULL, input_src_thread, args)) {
mp_input_src_kill(src);
@@ -1459,11 +1448,6 @@ int mp_input_add_thread_src(struct input_ctx *ictx, void *ctx,
return 0;
}
-int mp_input_src_get_wakeup_fd(struct mp_input_src *src)
-{
- return src->in->wakeup[0];
-}
-
#define CMD_BUFFER (4 * 4096)
void mp_input_src_feed_cmd_text(struct mp_input_src *src, char *buf, size_t len)