[MPlayer-users] Slave mode - detecting end of file.

Edd Barrett vext01 at gmail.com
Mon Feb 28 10:28:27 CET 2011

Hi there,

I have been googling around for a while trying to figure out how I can
detect when a song has finished playing on an instance of mplayer in
(idle) slave mode. My application is unable to queue multiple songs in
an mplayer slave because the playlist ordering is subject to change,
so it is vital I find a way to know when a song has ended.

I found an almost identical question here:

If you follow up the thread you eventually find reference to a patch
which did more or less this, but was abandoned.

So my question is, has anything changed since then? If not, can i
suggest that an idle mplayer slave should still repond to commands
even if nothing is playing?

So perhaps "get_file_name" might respond "FILE_NAME: <null>", which
can then be picked up by the master application. As it stands, mplayer
says nothing if nothing is playing, so read()s on a named pipe will
just block; this encourages people to write time sensitive code, which
I am dismissing on the grounds that it is too difficult to avoid race

Another idea: Perhaps, you can pass a PID to an mplayer slave so that
mplayer can send a SIGUSR1 to the master, indicating the end of a

For now my application will just fork a new mplayer for each track, as
i can easily detect the end of a track using a wait() or waitpid().

Any thoughts?


Best Regards
Edd Barrett


More information about the MPlayer-users mailing list