[Player-dev] remote control of player
Stefan Berger HerrStefanBerger at web.deHello!
I would like to be able to control the player by help of a small handwritten
C-program.
There are some documentation about control of the browser plugin (see 1).
Method is equivalent, I think.
Until now, I've written an C-program that opens a socketpair and starts
"realplayer --embedded X" (X = socket number)
The player listen for commands on the socket and when I'm sending "Shutdown"
the player exits.
But sending a command different from "Shutdown" runs in an error :-(
Are there some more documentation?
Could it be the commands are not the same (as used for the browserplugin)?
Here my C-prog (ist's a first version, there are errors, I know):
==================================================
#include <unistd.h> // exec(3)
#include <sys/types.h> // socketpair
#include <sys/socket.h> // -"-
#include <stdio.h>
#include <stdlib.h>
#define DATA "Shutdown\n"
int main(void)
{
int sockets[2]={}, status, eingabe;
socketpair(AF_UNIX, SOCK_STREAM, 0, sockets);
printf("Socket %d and %d created\n", sockets[0], sockets[1]);
if (fork() == 0)
execl("/usr/bin/realplay", "realplay", "--embedded", "3", 0);
close(sockets[0]);
printf("Commands:\n(0) Shutdown\n");
do
{
scanf("%d", &eingabe);
switch (eingabe)
{
case 0:
write(sockets[1], DATA, sizeof(DATA));
break;
}
}
while ( eingabe == 99 );
close(sockets[1]);
wait(&status);
printf("End\n");
return 0;
}
=================================================================
(This is my first post on this list)
Stefan
(1) https://player.helixcommunity.org/2004/developer/gtk/sods/ipc.html