[MPlayer-cvslog] r30780 - trunk/osdep/getch2-win.c

reimar subversion at mplayerhq.hu
Sun Feb 28 00:12:34 CET 2010


Author: reimar
Date: Sun Feb 28 00:12:34 2010
New Revision: 30780

Log:
Make -slave also work with the normal console on Windows.

Modified:
   trunk/osdep/getch2-win.c

Modified: trunk/osdep/getch2-win.c
==============================================================================
--- trunk/osdep/getch2-win.c	Sun Feb 28 00:09:15 2010	(r30779)
+++ trunk/osdep/getch2-win.c	Sun Feb 28 00:12:34 2010	(r30780)
@@ -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;
 }


More information about the MPlayer-cvslog mailing list