[MPlayer-users] How to properly terminate a looping mplayer

Tom Evans tevans.uk at googlemail.com
Wed Oct 19 10:38:50 CEST 2011


On Tue, Oct 18, 2011 at 5:50 PM, Deron Kazmaier <deron at pagestream.org> wrote:
> Hi,
>
> I wrote a fun little program that simple forks and runs mplayer, asking it
> to loop a video forever (-loop 0). I keep the pid, and when I detect a
> condition that requires the video to stop playing, I send mplayer a SIGTERM.
>
> That is all fine and dandy and works just fine, except that there is about a
> 50:50 chance that the shell will be screwed up when the program that calls
> mplayer terminates and returns to the shell. Nothing I type will appear, but
> it does accept the input (this is via ssh) and pressing return will execute
> whatever I type and it will display the shell prompt but on the same line. I
> know, very odd.
>
> So, the only thing I can think of is that SIGTERM mplayer caused some
> control code to be sent to stderr/stdout?
>
> Before I simply pipe output/input to null, I want to make sure that I'm
> stopping mplayer in an acceptable way or should I be sending a different
> signal or passing something via input pipe.
>
> Thanks! Still have a blast with mplayer!!
>
> Deron
>

Sounds like you just needed to reset your terminal - `reset' or `reset -e ^?'.

The best way to quit mplayer is to ask it to quit. You can send
commands to mplayer in a number of ways, see the documentation for the
-input option in mplayer's man page.

Cheers

Tom


More information about the MPlayer-users mailing list