[MPlayer-users] Pipe notification of media finishing

Jason Tackaberry tack at sault.org
Fri Apr 29 16:59:58 CEST 2005


On Fri, 2005-04-29 at 16:40 +0200, Stephane Cerveau wrote:
> I open Mplayer with this command :
> m_pFilePipe = popen("/usr/bin/mplayer -quiet -slave myMovie.avi" , "w");

This is more of a C question than an mplayer question, but ...

If you're calling mplayer this way, you're running pretty blind.  But
the most obvious way to see if mplayer has exited for how you're calling
it is to select on the file descriptor (gotten using fileno(3)).  If it
no longer appears in the set of write fds, mplayer has exited.  Read the
man page for select(2).  (This man page actually has a full code
example, which could be a first for any unix man page. :))

But if you want any kind of flexibility, you're going to want a two-way
conversation with mplayer.  (Create a couple of pipes, fork, and dup2
the child fds.)  This way you can see what MPlayer is sending to stdout
and use that for user feedback.

Jason.




More information about the MPlayer-users mailing list