Is any command to stop and pause the mplayer using the PId

1k Views Asked by At

hello friends i am playing mplayer from my qt application using the play button....i have two more buttons called pause and stop....in play button i used system ("mplayer "+s.toAscii()+"&"); where s is the playlist.

In the pause button i used system("p"); but it is not working. I am able to store the process id of mplayer to a text file using system("ps -A |grep mplayer > PID.txt");. Is there any command to stop and pause the mplayer using the PId....?

Thanks in Advance

2

There are 2 best solutions below

0
abesto On

Not with PID as far as I know. However, check out slave mode (-slave). From man mplayer:

This option switches on slave mode. This is intended for use of MPlayer as a backend to other programs. Instead of intercepting keyboard events, MPlayer will read simplistic command lines from its stdin. The section SLAVE MODE PROTOCOL explains the syntax.

0
Blue Phoenix On

In slave mode, you can send

"pause\n" 

to pause and resume. First time you send then it will pause and the second time sending will resume the playing.