[MPlayer-cygwin] mplayer slave mode on win32

Anton Ragnarsson anton.ragnarsson.1093 at student.uu.se
Fri Aug 13 12:46:41 CEST 2004


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?

Cheers,
Anton Ragnarsson




More information about the MPlayer-cygwin mailing list