[FFmpeg-devel] [PATCH] Support Ctrl+Break in ffmpeg.exe on Windows as if it was Ctrl+C

Joe Wreschnig joe.wreschnig at gmail.com
Tue Jun 19 23:51:59 CEST 2012


On Tue, Jun 19, 2012 at 7:10 PM, Reimar Döffinger
<Reimar.Doeffinger at gmx.de> wrote:
> On 19 Jun 2012, at 11:31, Joe Wreschnig <joe.wreschnig at gmail.com> wrote:
>> On Windows, the Ctrl+Break key combination usually does what Ctrl+C
>> does. It is more common for processes to send other processes
>> Ctrl+Break rather than Ctrl+C, because sending Ctrl+C / SIGINT doesn't
>> work if you started a child in a new process group.
>>
>> This patch makes ffmpeg.exe register what Windows calls a console
>> control event handler, which allows it to intercept Ctrl+Break. It
>> hands it off directly to the usual SIGINT/SIGTERM handler. The same
>> function also processes closing the console window, mapping it to
>> SIGTERM.
>>
>> Obviously, this is only enabled if compiling for a platform where
>> SetConsoleCtrlHandler is available (i.e. modern Windows).
>
> What is "modern"?

Win2k and everything since then. (Except maybe WinMe?) Versions before
that should work as before - meaning they won't support Ctrl+Break but
will still support Ctrl+C via the POSIX compatibility that makes
SIGINT work on Windows.

> Also it is rather unusual to recompile for different Windows versions, couldn't you with about the same effort just use GetProcAddress (more complex code, but in exchange you'd save on all the configure changes and #ifs).

I was copying the pattern already used in the file, e.g. for
GetProcessTimes and GetProcessMemoryInfo.

GetProcAddress wouldn't really change the #ifdefs. They'd just change
it to #ifdef _WIN32s but with more complicated logic.


More information about the ffmpeg-devel mailing list