[MPlayer-users] MPlayer hangs in slave mode on Windows

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Dec 14 18:44:23 CET 2014


On Sun, Dec 14, 2014 at 02:23:32AM +0400, Anton Sviridenko wrote:
> > I you use slave mode you must connect stdin to a proper file/pipe where read, select etc. works in the expected way.
> > In the normal command-line stdin is connect to a console which is a horrible and crazy construct that behaves in no sane way, so all kinds of strange effects happen (since -slave disables the workarounds we use to read keyboard input from it).
> 
> Looks like this piece of code is responsible for that in osdep/getch2-win.c:
> 
>   HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
>   if(PeekNamedPipe(in, NULL, size, &retval, NULL, NULL)){
> 
> and PeekNamedPipe() does not work on console handles.

Whether PeekNamedPipe works should not be a problem as it falls back to
WaitForSingleObject.
However I expect that for console handles WaitForSingleObject returning
a signalled state does not mean that a ReadFile will succeed and not block.
It would be possible to add another case using GetNumberOfConsoleInputEvents
if you absolutely want to support it, but I doubt there is much value in
it since I'd expect it to work rather badly anyway.
Though I guess it might be possible to check for a console handle and
warn about it not being supported, as a user-friendliness feature...
Note: I don't volunteer to implement it, but patches welcome :)


More information about the MPlayer-users mailing list