[MPlayer-dev-eng] Slave Mode

Ben Nemec cybertron at flashmail.com
Fri Oct 17 01:45:51 CEST 2003


Hi,
I am having trouble using slave mode in my C++ project.  I've managed to get 
popen to pipe data to mplayer, but it doesn't do anything with it until I 
close the pipe, which freezes the program and doesn't allow me to do anything 
after that.  The code below is how I'm trying to do it, and if anyone could 
help me out it would be appreciated.  I'm sure someone is thinking RTFM, but 
I can't find anything about how to use slave mode anywhere, except the 
different commands that are available.  If you could point me in the 
direction of something better, that would also be very helpful and would keep 
me out of everyone's hair more:-)  Thanks.

FILE *pipe_fp;

void quiForm::init()
{
	if (( pipe_fp = popen("mplayer -slave playlist", "w")) == NULL)
	{
		perror("popen");
		exit(1);
	}
}

void quiForm::destroy()
{
	//pclose(pipe_fp);  I would rather have this here.
}

void quiForm::PlayButton_clicked()
{
	fputs("pause\n", pipe_fp);
	pclose(pipe_fp);  // I really need to get rid of this
}

Thanks for taking the time to look at this.  I know it's a very newbie type 
question, but I just can't seem to get it to work right.

-Ben



More information about the MPlayer-dev-eng mailing list