[MPlayer-users] Use of -slave option in latest CVS

Alban Bedel albeu at free.fr
Sun Feb 24 00:35:02 CET 2002


Hi Tom Bednarchuk,

on Sat, 23 Feb 2002 17:11:51 -0500 you wrote:

> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> Hi Alban,
> > Hi Tom Bednarchuk,
> >
> > on Sat, 23 Feb 2002 00:18:19 -0500 you wrote:
> >
> > > [Automatic answer: RTFM (read DOCS, FAQ), also read
> DOCS/bugreports.html]
> > > Hi again Alban:
> > >
> > > I tried the following PERL with MPlayer and only the quit command
> worked.
> > > Can you take a look?
> > >
> > > #!/usr/bin/perl -w
> > > print "Hello there !"
> > >
> > > open(MPPIPE, "|mplayer -slave -vo x11 /mnt/cdrom/bootyl~2.mpg");
> > > sleep 40;
> > > print MPPIPE "stop\n";
> > > sleep 10;
> > > print MPPIPE "play\n";
> > > sleep 40;
> > > print MPPIPE "quit\n";
> > >
> > > The video plays for the 90 or so seconds taken up by the sleep() total
> but
> > > the stop doesn't seem to work. I put in some printf 's in mplayer.c
> where
> > > the command is parsed and after the video stops, the printf 's show up
> on
> > > the console but mpayer seems not to care.
> > Neither stop or play are part of the actual command list.
> > But you can try to use this in place : stop = "seek 0\npause\n" and play =
> "pause\n".
> > It shoud do the job, except it will not close the window.
> > Albeu
> I don't quite understand. In mplayer.c , (search for /* slave mode */) there
> are lines to the effect
> 
> if (!strcmp("play\n", buffer)) {
>     osd_function=OSD_PLAY;
> }   else if (!strcmp("stop\n, buffer)) {
>     osd_function=OSD_PAUSE;
> } ......................
>
> So I don't understand how "seek 0\npause\n" will work since they aren't
> valid parse lines. Or have I missed something, again ?
Yes, there is two version. With new-input and wihout. The code you pointed out is
the old one. With new-input the command parsing is done in input/input.c
wich translate them in mp_cmd_t struct. Then mplayer.c read the mp_cmd_t
using mp_input_get_cmd and perform the action. Note that now new-input is
the default, and there is no play and stop cmd in new-input. If you want you
can use the old code (reconfigure with --disable-new-input), but there is
not many command.

> If I put printf's in the above, they are output but only after the video
> stops. "quit\n" is the only command that I can get to work, probably because
> it calls exit_player() directly. I'm not quite sure how the osd_function is
> supposed to work, any hints would be appreciated.
This is the job of mplayer. If you just want to deal with the salve mode. Look into 
input/input.c all know commands are there (quit is one of them). Just send them 
separated with \n in your pipe. You can send more than one cmd at once, it's why
I proposed to use the sequence "seek 0\npause\n" to replace stop.
	Albeu

PS: You use lastest CVS, rigth ?




More information about the MPlayer-users mailing list