[MPlayer-users] Using slave mode

Andrea Visinoni andrea at puntualmenteinritardo.com
Mon Aug 3 23:35:10 CEST 2009


Adrian Stutz ha scritto:
> On Mon, Aug 3, 2009 at 11:02 PM, Andrea
> Visinoni<andrea at puntualmenteinritardo.com> wrote:
>> Hi,
>> i'm trying to use mplayer in slave mode from a C test application.
>> I can successfully send commands through a fifo using -input file=fifo.file,
>> but i'm facing some problems trying to read from the fifo.
>> Is there an example? if i try to send "volume" to the fifo i read "volume"
>> again. i'm missing something?
> 
> Did you try "get_property volume"?
> I don't think just sending "volume" is supposed to send you anything
> back in return.
> 
> Adrian

The slave.txt is not so clear, thank you.
This is my simple test application, sending the loadfile command or quit 
works great, get_property not.
I always read the same thing i'm sending.

#define MPLAYER_FIFO_NAME   "/tmp/mplayer.fifo"

int main(void)
{
	int fd_in, fd_out, num, res;
	char s[255];

	fd_in = open(MPLAYER_FIFO_NAME, O_RDONLY);
	fd_out = open(MPLAYER_FIFO_NAME, O_WRONLY);

//	strcpy(s, "quit\n");
//	strcpy(s, "loadfile /home/andrea/cyzYR_kSyRc.mpeg\n");
	strcpy(s, "get_property fullscreen\n");
	write (fd_out, s, strlen(s));

	if ((num = read(fd_in, s, 255)) == -1)
		perror("read");
	else
	{
         	s[num] = '\0';
	        printf("read %d bytes: \"%s\"\n", num, s);
	}

	return 0;
}


Andrea


More information about the MPlayer-users mailing list