qt4 - Is there a command to stop and pause mplayer using the PId? -
i playing mplayer qt application using play button. have 2 buttons called pause , stop. play button used system ("mplayer "+s.toascii()+"&");
s
playlist.
for pause button used system("p");
not working. able store process id of mplayer text file using system("ps -a |grep mplayer > pid.txt");
.
is there command stop , pause mplayer using pid?
what want mplayer's slave mode of input, makes easy give commands program. can launch mplayer in mode giving -slave
command line option when launching it.
in mode, mplayer ignores standard input bindings , instead accepts different vocabulary of text commands can sent 1 @ time separated newlines. full list of commands supported, run mplayer -input cmdlist
.
since have tagged question qt, i'm going assume using c++. here's example program in c demonstrating how use mplayer's slave mode:
#include <stdio.h> #include <unistd.h> int main() { file* pipe; int i; /* open mplayer child process, granting write access input */ pipe = popen("mplayer -slave 'your_audio_file_here.mp3'", "w"); /* play around little */ (i = 0; < 6; i++) { sleep(1); fputs("pause\n", pipe); fflush(pipe); } /* let mplayer finish, close pipe */ pclose(pipe); return 0; }
Comments
Post a Comment