[MPlayer-users] mplayer -slave... (how to) disable, keyboard input?

Ulion ulion2002 at gmail.com
Sun Dec 2 04:10:41 CET 2007


2007/12/1, Lee Jackson <leej at morphemass.com>:
> Lee Jackson wrote:
> > Lee Jackson wrote:
> >
> >
> >>> "The -slave option switches on slave mode, in which MPlayer works as a backend
> >>> for other programs. Instead of intercepting keyboard events, MPlayer will read
> >>> commands separated by a newline (\n) from stdin." - slave.txt
> >>>
> >>> I'm probably misunderstanding what was intended here because the behavior I'm seeing in MPlayer doesn't match this description.
> >>>
> >>> Basically, I want to disable keyboard commands when the mplayer video window has focus so that a press of "q", for example, doesn't quit the application. However if I run :
> >>>
> >>> mplayer -slave -quiet egvideo.avi
> >>>
> >>> a press of "q" will still quit if the window has focus (I can also do "q<return>" from the launching console window). I've tried this with the -noconsolecontrols option to no avail.
> >>>
> >>> So am I misunderstanding the meaning of the above or is there something wrong here? (MPlayer 1.0rc2-4.1.3 by the way)
> >>>
> >>> tia
> >>>
> >>> Lee
> >>>
> >>
> >> Add "-noconsolecontrols" to your commandline
> >>
> >> Kevin
> >>
> >
> > Seems I switched to non-digest email too late so only had a digest with this response in. My apology's in advance for the out of thread response.
> >
> > I have already tried -noconsolecontrols (as a commandline option) as detailed above. Does your response mean that my interpretation of what *should* be happening is at least correct?
> >
> >
> I had a little time to look at this in some more detail this morning.
>
> mplayer.c line 2604
> mp_input_add_key_fd(-1,0,mplayer_get_key,NULL);
>
> The above line seems to be responsible for adding console keyboard input
> and if it is commented out, or the line immediately prior is prefixed by
> a suitable if statement [ e.g. if (!slave_mode) ], then slave mode works
> as I had expected it to behave. Thats a very quick hack though, based on
> VERY limited knowledge (note that Im also observing this problem with
> the svn version obviously).
>
> Anways, the console keyboard input behavior in slave mode APPEARS to be
> broken (and from browsing the rep, has been for a long time) and it
> would be useful for an active developer to have a look at this - it may
> just be a case of the documentation differing from the
> implimentation.... as an aside, the importance of this to me is that I'm
> embedding mplayer in a QT4 widget and I want to disable any other input
> apart from that which I define.
>
> I note there are several GUIs for mplayer which presumably are not
> affected by this; can anyone provide a quick heads up on how they
> approach remapping/ignoring mplayers keyboard handling?
>
> One other thing, An additional quite from the help file :
>
> "-noconsolecontrols
> Prevent MPlayer from reading key events from standard input. Useful when
> reading data from standard input. This is automatically enabled when -
> is found on the command line. There are situations where you have to set
> it manually, e.g. if you open /dev/stdin (or the equivalent on your
> system), use stdin in a playlist or intend to read from stdin later on
> via the load©\file or loadlist slave commands."
>
> I'm having a little difficulty understanding this but it sounds to me
> like it should do, more-or-less the same as slave_mode in regards to
> keyboard input? If thats the case then its similarly broken.

The mplayer_get_key is for receiving input key event from vo, includes
when the video window get closed, it send a CLOSE_WIN event and
mplayer got the key event and quit.
I don't know how your QT4 widget handle with mplayer's video window
and its close event, so not sure whether disable all such key event is
a good idea for you.


-- 
Ulion


More information about the MPlayer-users mailing list