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

Alexander Strasser eclipse7 at gmx.net
Tue Jan 10 21:24:44 CET 2012


yann.lepetitcorps at free.fr wrote:
> > Michael Niedermayer wrote:
> > > This allows to get out of ffplay if it or SDL got stuck.
> > > This for example happens when the audio driver is playing something
> > > else and doesnt support mixing multiple sources.
> >
> >   I principally like it.
> [...]
> 
> > > +static void sigterm_handler(int sig)
> > > +{
> > > +    exit(123);
> > > +}
> >
> >   Not sure how bad this can be for ffplay on usual systems,
> > but I think it is not safe to call exit() from a signal
> > handling context.
> >
> >   Maybe using _exit or _Exit would be better if it is acceptable
> > to depend on it. I can't think of any alternate approaches right
> > now.
> >
> > [...]
> 
> The sigterm_handler() func can perhaps to be used for to store the sig value
> into a global variable that is checked after into ffplay ?
> 
>     static int force_exit = 0;
> 
>     static void sigterm_handler(int sig)
>     {
>         force_exit = 123;
>     }
> 
> 
> Somewhere into ffplay, "at the good instant"
> 
>    if( force_exit != 0 )
>    {
>        // close/delete alls necessary stuffs
>        ...
> 
>        exit(force_exit);
>    }

  I guess that would not fix the problem described above.

  Alexander


More information about the ffmpeg-devel mailing list