[MPlayer-users] mencoder /mplayer bugs

Noel Burton-Krahn noel at bkbox.com
Wed Jun 11 23:03:44 CEST 2003


Try using a pty device to control mplayer.  Here's how in perl:

use IO::Pty;

# forks and returns a pty connected to mplayer
sub start_mplayer {
    my(@mplayer_args) = @_;

    $mplayer_pty = IO::Pty->new() or die("pty: $!");
    $mplayer_pid = fork();
    if( $mplayer_pid != 0 ) {
        $mplayer_pty->close_slave();
        return($mplayer_pty, $mplayer_pid);
    }

    # the child
    $mplayer_pty->make_slave_controlling_terminal();
    open(STDIN, "<&" . $mplayer_pty->slave()->fileno());
    #open(STDOUT, ">&" . $mplayer_pty->slave()->fileno());
    open(STDOUT, ">/dev/null");

    exec('mplayer', @mplayer_args);
}





----- Original Message -----
From: "Corey Hickey" <bugfood-ml at fatooh.org>
To: "MPlayer user's list." <mplayer-users at mplayerhq.hu>
Sent: Wednesday, June 11, 2003 1:54 PM
Subject: Re: [MPlayer-users] mencoder /mplayer bugs


> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> jean luc MALET wrote:
> >
> > in fact using the slave mode I could calculate the timings if I could
> > have the slave mode working.....
> > It seems to work when I type on the mplayer xterm but remote don't work
> > (ie redirecting using a fifo or a pipe the control output to mplayer
> > input).....
>
> I just messed around with slave mode and a fifo. I'm able to control it
> by:
>
> $ mkfifo fifo
> $ mplayer file.avi -slave < fifo
> (mplayer waits for the fifo). Now, in another terminal:
> $ cat > fifo
> (mplayer starts playing). You can type commands to cat and mplayer will
> observe them. Now, if you hit ^D to end catting, mplayer continues to
> play but will not recognize any more input from the fifo. I really don't
> know if this is expected/proper/normal behavior; usually I only use
> fifos for non-interactive stuff. In those cases, however, when the
> program at one end of the pipe quits, so does the other. Perhaps mplayer
> just "closes" the fifo at its end, and ignores it henceforth.
>
> -Corey
>
> _______________________________________________
> RTFM!!!  http://www.MPlayerHQ.hu/DOCS
> Search:  http://www.MPlayerHQ.hu/cgi-bin/htsearch
> http://mplayerhq.hu/mailman/listinfo/mplayer-users
>
>



More information about the MPlayer-users mailing list