[MPlayer-cygwin] mplayer slave mode on win32

Sascha Sommer saschasommer at freenet.de
Fri Aug 13 17:46:47 CEST 2004


On Friday 13 August 2004 10:46, Anton Ragnarsson wrote:
> Hi all!
>
> I've been trying to use the win32 version of mplayer in slave mode,
> but with little success. It works when writing commands manually
> in the console, but not when sending to stdin via a pipe (i.e popen or
> CreateProcess).
>
> Anyway, I looked in the source code and found that the function
> mp_input_win32_slave_cmd_func() in osdep/getch2-win.c was
> a bit "weird". It directly reads input events from the console instead of
> treating stdin as a file. So I changed it into:
>
> int mp_input_win32_slave_cmd_func(int fd,char* dest,int size){
>     DWORD retval;
>     int x=0;
>     HANDLE stdin = GetStdHandle(STD_INPUT_HANDLE);
>     if (!PeekNamedPipe(stdin, NULL, size, &retval, NULL, NULL) || !retval)
>         return MP_INPUT_NOTHING;
>     ReadFile(stdin, dest, retval, &retval, NULL);
>     x = retval;
>     if(x)return x;
>     return MP_INPUT_NOTHING;
> }
>
> And now slave mode works great!
> Just thought maybe some of you windows porting guys might want
> to add this to CVS or something?
>

Commited.
Hope this helps the gui coders to write a cool windows gui.

Sascha




More information about the MPlayer-cygwin mailing list