Browse code

Proper check for interactive support (termios and conio).

Originally committed as revision 9597 to svn://svn.ffmpeg.org/ffmpeg/trunk

Ramiro Polla authored on 2007/07/11 23:04:54
Showing 2 changed files
... ...
@@ -651,6 +651,7 @@ HAVE_LIST="
651 651
     arpa_inet_h
652 652
     byteswap_h
653 653
     cmov
654
+    conio_h
654 655
     dcbzl
655 656
     dev_bktr_ioctl_bt848_h
656 657
     dev_bktr_ioctl_meteor_h
... ...
@@ -681,6 +682,7 @@ HAVE_LIST="
681 681
     soundcard_h
682 682
     sys_poll_h
683 683
     sys_soundcard_h
684
+    termios_h
684 685
     threads
685 686
 "
686 687
 
... ...
@@ -1510,6 +1512,9 @@ check_header byteswap.h
1510 1510
 
1511 1511
 check_func mkstemp
1512 1512
 
1513
+check_header termios.h
1514
+check_header conio.h
1515
+
1513 1516
 check_header arpa/inet.h
1514 1517
 
1515 1518
 check_func inet_aton
... ...
@@ -34,9 +34,9 @@
34 34
 #include "fifo.h"
35 35
 #include "avstring.h"
36 36
 
37
-#ifdef __MINGW32__
37
+#if defined(HAVE_CONIO_H)
38 38
 #include <conio.h>
39
-#else
39
+#elif defined(HAVE_TERMIOS_H)
40 40
 #include <unistd.h>
41 41
 #include <fcntl.h>
42 42
 #include <sys/ioctl.h>
... ...
@@ -277,7 +277,7 @@ typedef struct AVInputFile {
277 277
     int nb_streams;       /* nb streams we are aware of */
278 278
 } AVInputFile;
279 279
 
280
-#ifndef __MINGW32__
280
+#ifdef HAVE_TERMIOS_H
281 281
 
282 282
 /* init terminal so that we can grab keys */
283 283
 static struct termios oldtty;
... ...
@@ -285,7 +285,7 @@ static struct termios oldtty;
285 285
 
286 286
 static void term_exit(void)
287 287
 {
288
-#ifndef __MINGW32__
288
+#ifdef HAVE_TERMIOS_H
289 289
     tcsetattr (0, TCSANOW, &oldtty);
290 290
 #endif
291 291
 }
... ...
@@ -301,7 +301,7 @@ sigterm_handler(int sig)
301 301
 
302 302
 static void term_init(void)
303 303
 {
304
-#ifndef __MINGW32__
304
+#ifdef HAVE_TERMIOS_H
305 305
     struct termios tty;
306 306
 
307 307
     tcgetattr (0, &tty);
... ...
@@ -334,10 +334,10 @@ static void term_init(void)
334 334
 /* read a key without blocking */
335 335
 static int read_key(void)
336 336
 {
337
-#ifdef __MINGW32__
337
+#if defined(HAVE_CONIO_H)
338 338
     if(kbhit())
339 339
         return(getch());
340
-#else
340
+#elif defined(HAVE_TERMIOS_H)
341 341
     int n = 1;
342 342
     unsigned char ch;
343 343
 #ifndef CONFIG_BEOS_NETSERVER