On 6/25/15, James Almer <jamr...@gmail.com> wrote: > On 24/06/15 7:19 AM, Roger Pack wrote: >> +#ifdef HAVE_SETCONSOLECTRLHANDLER >> +static BOOL WINAPI CtrlHandler(DWORD fdwCtrlType) >> +{ >> + av_log(NULL, AV_LOG_DEBUG, "\nReceived windows signal %d\n", >> fdwCtrlType); >> + >> + switch (fdwCtrlType) >> + { >> + case CTRL_C_EVENT: >> + case CTRL_BREAK_EVENT: >> + sigterm_handler(SIGINT); >> + return TRUE; >> + >> + case CTRL_CLOSE_EVENT: >> + case CTRL_LOGOFF_EVENT: >> + case CTRL_SHUTDOWN_EVENT: >> + sigterm_handler(SIGTERM); >> + return TRUE; >> + >> + default: >> + av_log(NULL, AV_LOG_ERROR, "Received unknown windows signal >> %d\n", fdwCtrlType); >> + return FALSE; >> + } >> +} >> +#endif >> + >> void term_init(void) >> { >> #if HAVE_TERMIOS_H >> @@ -358,6 +386,9 @@ void term_init(void) >> #ifdef SIGXCPU >> signal(SIGXCPU, sigterm_handler); >> #endif >> +#ifdef HAVE_SETCONSOLECTRLHANDLER >> + SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, TRUE); >> +#endif > > Why ffmpeg only? Can't this be in cmdutils.c to also work with the other > tools?
It basically piggy backs on the existing signal handling code, which I guess is FFmpeg only (probably each process needs to setup their own signal handling). At least it'll be a nice example for people to use if they need to :) -roger- _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel