[MPlayer-users] How can I get info from mplayer???

Jason Tackaberry tack at sault.org
Thu Jun 9 15:09:33 CEST 2005


On Thu, 2005-06-09 at 11:26 +0200, Stephane Cerveau wrote:
> I use mplayer in my application and i would like to cmmunicate with it.
> I know how to send command to it but i dont know how to get info from
> his behaviour???

You need to establish a bidirectional pipe with MPlayer.  Some high
level languages make this easy.  In python, you just need to do:

   mp_stdin, mp_stdout = os.popen4(cmd)

And there you have a pair of file objects you can write/read to, and
select on.

But it looks like you're using C++, so you'll have to do it the hard
way, unless the wx api offers the ability to do this.  (I have no idea
if it does.)  The general approach is to setup a couple pairs of pipe
with pipe(2), fork, and use dup2(2) to map mplayer's stdin and stdout to
the appropriate parts of the pipes you just created.

This is much on the net on this topic.  Google will show you the way.

Cheers,
Jason.




More information about the MPlayer-users mailing list