path: root/
diff options
authorwm4 <wm4@nowhere>2014-08-24 23:50:43 +0200
committerwm4 <wm4@nowhere>2014-08-25 01:00:21 +0200
commit740f0f61d840255a02efcf392fece51486a59183 (patch)
tree55b91801f9c23badec307a21a945fda8725d8ad2 /
parentcae22ae3b6e6d4c40ef6fc153a9538f8fea6b0e5 (diff)
input: redo how --input-file is handled
Abandon the "old" infrastructure for --input-file (mp_input_add_fd(), select() loop, non-blocking reads). Replace it with something that starts a reader thread, using blocking input. This is for the sake of Windows. Windows is a truly insane operating system, and there's not even a way to read a pipe in a non-blocking way, or to wait for new input in an interruptible way (like with poll()). And unfortunately, some want to use pipe to send input to mpv. There are probably (slightly) better IPC mechanisms available on Windows, but for the sake of platform uniformity, make this work again for now. On Vista+, CancelIoEx() could probably be used. But there's no way on XP. Also, that function doesn't work on wine, making development harder. We could forcibly terminate the thread, which might work, but is unsafe. So what we do is starting a thread, and if we don't want the pipe input anymore, we just abandon the thread. The thread might remain blocked forever, but if we exit the process, the kernel will forcibly kill it. On Unix, just use poll() to handle this. Unfortunately the code is pretty crappy, but it's ok, because it's late and I wanted to stop working on this an hour ago. Tested on wine; might not work on a real Windows.
Diffstat (limited to '')
1 files changed, 1 insertions, 0 deletions
diff --git a/ b/
index c138d606b6..cfd28088da 100644
--- a/
+++ b/
@@ -193,6 +193,7 @@ def build(ctx):
( "input/event.c" ),
( "input/input.c" ),
( "input/keycodes.c" ),
+ ( "input/pipe.c" ),
( "input/joystick.c", "joystick" ),
( "input/lirc.c", "lirc" ),