[FFmpeg-devel] [PATCH] ffplay: Exit on ctrl-c.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Thu Jan 12 00:31:32 CET 2012


On Wed, Jan 11, 2012 at 10:29:32PM +0100, Alexander Strasser wrote:
> yann.lepetitcorps at free.fr wrote:
> > Selon Alexander Strasser <eclipse7 at gmx.net>:
> > In this case, we can perhaps use something like this ?
> > 
> > 
> >     static void signal_handler(int sig)
> >     {
> >         switch(sig)
> >         [
> >             case SIGTERM  :
> >             case SIGKILL  :  exit(123); break;
> >             ...
> >             case SIGINT   :
> >             default       : force_exit = 0; break;
> >         }
> >     }
> 
>   I am sorry this is still messed up. I also don't think that
> approach will give any practical improvements while introducing
> more complexity. I am fine with the current solution, Micheal's
> initial patch, as is ffplay maintainer Marton.
> 
>   Just wanted to hear any opinions on the rather theoretical issue,
> so thanks for taking part in the discussion.

The only option I see is the approach MPlayer uses:
First just set a flag, but if more signals come in go over to more
desperate means, if necessary even a direct exit().
As for signal-safety: "man 7 signal" list signal-safe functions,
so to avoid exit while staying portable FFmpeg could e.g. send
a SIGKILL to itself.


More information about the ffmpeg-devel mailing list