summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-06-27 13:47:46 +0200
committerwm4 <wm4@nowhere>2017-06-29 10:30:16 +0200
commit7eca787571aab982acaadee79abb0f40f9f14b6a (patch)
tree250369f402ba9b45b32e0d4e78afda3043af5172 /input
parent70a70b9da347d7ef25a9862af83731b9b0a0d3f1 (diff)
downloadmpv-7eca787571aab982acaadee79abb0f40f9f14b6a.tar.bz2
mpv-7eca787571aab982acaadee79abb0f40f9f14b6a.tar.xz
build: change how some OS specific source files are selected
In a bunch of cases, we emulate highly platform specific APIs on a higher level across all OSes, such as IPC, terminal, subprocess handling, and more. We have source files for each OS, and they implement all the same mpv internal API. Selecting which source file to use on an OS can be tricky, because there is partially overlapping and emulated APIs (consider Cygwin on Windows). Add a pick_first_matching_dep() function to make this slightly easier and more structured. Also add dummy backends in some cases, to deal with APIs not being available. Clarify the Windows dependency identifiers, as these are the most confusing.
Diffstat (limited to 'input')
-rw-r--r--input/input.c2
-rw-r--r--input/input.h2
-rw-r--r--input/ipc-dummy.c13
3 files changed, 16 insertions, 1 deletions
diff --git a/input/input.c b/input/input.c
index ee58709017..4a20ab1311 100644
--- a/input/input.c
+++ b/input/input.c
@@ -1392,7 +1392,7 @@ void mp_input_load_config(struct input_ctx *ictx)
talloc_free(tmp);
}
-#if defined(__MINGW32__)
+#if HAVE_WIN32_PIPES
if (ictx->global->opts->input_file && *ictx->global->opts->input_file)
mp_input_pipe_add(ictx, ictx->global->opts->input_file);
#endif
diff --git a/input/input.h b/input/input.h
index ea8460889c..00f5473f7b 100644
--- a/input/input.h
+++ b/input/input.h
@@ -259,6 +259,8 @@ void mp_input_pipe_add(struct input_ctx *ictx, const char *filename);
struct mp_ipc_ctx;
struct mp_client_api;
+
+// Platform specific implementation, provided by ipc-*.c.
struct mp_ipc_ctx *mp_init_ipc(struct mp_client_api *client_api,
struct mpv_global *global);
void mp_uninit_ipc(struct mp_ipc_ctx *ctx);
diff --git a/input/ipc-dummy.c b/input/ipc-dummy.c
new file mode 100644
index 0000000000..d9c31c046c
--- /dev/null
+++ b/input/ipc-dummy.c
@@ -0,0 +1,13 @@
+#include <stddef.h>
+
+#include "input/input.h"
+
+struct mp_ipc_ctx *mp_init_ipc(struct mp_client_api *client_api,
+ struct mpv_global *global)
+{
+ return NULL;
+}
+
+void mp_uninit_ipc(struct mp_ipc_ctx *ctx)
+{
+}