- To use mplayer -input cmdlist finds out which command that can support by slave mode
- The slave mode reference
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <iostream>
#include <string>
using namespace std;
int main()
{
int pipefd[2] = {0};
if(pipe(pipefd) != 0) {
printf("pipe open failed\n");
}
if(fork() != 0) {
string command;
close(pipefd[0]);
while(1) {
cout << "command:";
cin >> command;
command += "\n";
write(pipefd[1], command.c_str(), command.length());
}
} else {
dup2(pipefd[0], fileno(stdin));
execl("/usr/bin/mplayer", "mplayer",
"-slave", "-fs", "-osdlevel", "0", "-really-quiet",
"-input", "nodefault-bindings", "-noconfig", "all",
"/home/archer/Videos/300_Trailer2_8mbps_1080p29.98_5.1.wmv", NULL);
}
return 0;
}
沒有留言:
張貼留言