diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-02-27 23:12:34 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-02-27 23:12:34 +0000 |
commit | 490a015043f105f3c80bdbde187166c469f3d63f (patch) | |
tree | fb3b05c7f4074b47df08e859eff17aefa3e815d8 /osdep | |
parent | 67f9e11d9336028e374b4c03b5632a8e28a54f7d (diff) | |
download | mpv-490a015043f105f3c80bdbde187166c469f3d63f.tar.bz2 mpv-490a015043f105f3c80bdbde187166c469f3d63f.tar.xz |
Make -slave also work with the normal console on Windows.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30780 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/getch2-win.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/osdep/getch2-win.c b/osdep/getch2-win.c index 45f68e8196..dd6268b06a 100644 --- a/osdep/getch2-win.c +++ b/osdep/getch2-win.c @@ -35,11 +35,16 @@ int mp_input_slave_cmd_func(int fd,char* dest,int size){ DWORD retval; HANDLE in = GetStdHandle(STD_INPUT_HANDLE); - if(!PeekNamedPipe(in, NULL, size, &retval, NULL, NULL) || !retval){ + if(PeekNamedPipe(in, NULL, size, &retval, NULL, NULL)){ + if (size > retval) size = retval; + } else { + if (WaitForSingleObject(in, 0)) + size = 0; + } + if(!size){ return MP_INPUT_NOTHING; } - if(retval>size)retval=size; - ReadFile(in, dest, retval, &retval, NULL); + ReadFile(in, dest, size, &retval, NULL); if(retval)return retval; return MP_INPUT_NOTHING; } |