[MPlayer-users] Questions about processes and process control
Ed Greenberg
edg at greenberg.org
Sat Jun 14 23:04:20 CEST 2008
I am using mplayer to download and save a stream. In a perl script, I
fork and exec mplayer as follows:
mplayer -ao pcm:waveheader:file=filename.wav -cache 256 -quiet
mms://urlcontinues.....
I get two processes :
edg 2333 2332 9 13:12 pts/3 00:00:05 mplayer -ao
pcm:waveheader:file=xm1min.wav -cache 256 -quiet mms://urlcontinues...
edg 2334 2333 0 13:12 pts/3 00:00:00 mplayer -ao
pcm:waveheader:file=xm1min.wav -cache 256 -quiet mms://urlcontinues...
My perl script gets 2333 as the child's PID.
Now I wait in a sleep until sufficient time has passed, and I then kill
-1 the child pid. This works fine. The file is closed and I get a full
recording of my stream.
Unfortunately, I am left with process 2334 still running.
On stderr I get:
MPlayer interrupted by signal 1 in module: decode_audio
- MPlayer crashed. This shouldn't happen.
It can be a bug in the MPlayer code _or_ in your drivers _or_ in your
gcc version. If you think it's MPlayer's fault, please read
DOCS/HTML/en/bugreports.html and follow the instructions there. We
can't and
won't help unless you provide this information when reporting a
possible bug.
I'm not reporting it as a bug, since, indeed it was interrupted by a
signal 1.
So I reset my calling program to kill $process+1, which kills both of
them (although, going forward, I know I can't depend on them being
sequential) and now I get a second message on stderr:
MPlayer interrupted by signal 1 in module: enable_cache
followed by the paragraph about reporting bugs.
So I have several questions:
0. what's the purpose of the second process. Is one a caching process?
Do I need it if my source is a nice fast cable connection, and my
destination is -ao pcm:waveheader?
1. What's the best way to tell mplayer to run for a period of time and
then stop? Is the idea of forking it and then killing it the best choice?
2. If I'm going to kill it externally, what's the best signal to kill it
on, so that it takes down both processes, if at all?
3, If I have to kill the two processes separately, which should I kill
first?
Many thanks,
</edg>
Ed Greenberg
More information about the MPlayer-users
mailing list