MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / term_init

Function term_init

fftools/ffmpeg.c:205–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203#endif
204
205void term_init(void)
206{
207#if defined __linux__
208 struct sigaction action = {0};
209 action.sa_handler = sigterm_handler;
210
211 /* block other interrupts while processing this one */
212 sigfillset(&action.sa_mask);
213
214 /* restart interruptible functions (i.e. don't fail with EINTR) */
215 action.sa_flags = SA_RESTART;
216#endif
217
218#if HAVE_TERMIOS_H
219 if (stdin_interaction) {
220 struct termios tty;
221 if (tcgetattr (0, &tty) == 0) {
222 oldtty = tty;
223 restore_tty = 1;
224
225 tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
226 |INLCR|IGNCR|ICRNL|IXON);
227 tty.c_oflag |= OPOST;
228 tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
229 tty.c_cflag &= ~(CSIZE|PARENB);
230 tty.c_cflag |= CS8;
231 tty.c_cc[VMIN] = 1;
232 tty.c_cc[VTIME] = 0;
233
234 tcsetattr (0, TCSANOW, &tty);
235 }
236 SIGNAL(SIGQUIT, sigterm_handler); /* Quit (POSIX). */
237 }
238#endif
239
240 SIGNAL(SIGINT , sigterm_handler); /* Interrupt (ANSI). */
241 SIGNAL(SIGTERM, sigterm_handler); /* Termination (ANSI). */
242#ifdef SIGXCPU
243 SIGNAL(SIGXCPU, sigterm_handler);
244#endif
245#ifdef SIGPIPE
246 signal(SIGPIPE, SIG_IGN); /* Broken pipe (POSIX). */
247#endif
248#if HAVE_SETCONSOLECTRLHANDLER
249 SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, TRUE);
250#endif
251}
252
253/* read a key without blocking */
254static int read_key(void)

Callers 2

assert_file_overwriteFunction · 0.85
ffmpeg_parse_optionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected