[FFmpeg-devel] [PATCH 1/2] ffmpeg: don't reconfigure terminal if we're not taking input from stdin

Rodger Combs rodger.combs at gmail.com
Sat Sep 10 23:54:44 EEST 2016


---
 ffmpeg.c     | 4 +---
 ffmpeg_opt.c | 3 +++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index d858407..111d844 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -366,7 +366,7 @@ static BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
 void term_init(void)
 {
 #if HAVE_TERMIOS_H
-    if(!run_as_daemon){
+    if (!run_as_daemon && stdin_interaction) {
         struct termios tty;
         if (tcgetattr (0, &tty) == 0) {
             oldtty = tty;
@@ -4328,8 +4328,6 @@ int main(int argc, char **argv)
 
     show_banner(argc, argv, options);
 
-    term_init();
-
     /* parse options and open all input/output files */
     ret = ffmpeg_parse_options(argc, argv);
     if (ret < 0)
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 2ea09cf..4d3d4c4 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -3102,6 +3102,9 @@ int ffmpeg_parse_options(int argc, char **argv)
         goto fail;
     }
 
+    /* configure terminal and setup signal handlers */
+    term_init();
+
     /* open input files */
     ret = open_files(&octx.groups[GROUP_INFILE], "input", open_input_file);
     if (ret < 0) {
-- 
2.10.0



More information about the ffmpeg-devel mailing list