mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-04-23 23:46:41 +00:00
Proper check for interactive support (termios and conio).
Originally committed as revision 9597 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
6ffa87d325
commit
e16e49ac90
5
configure
vendored
5
configure
vendored
@ -651,6 +651,7 @@ HAVE_LIST="
|
|||||||
arpa_inet_h
|
arpa_inet_h
|
||||||
byteswap_h
|
byteswap_h
|
||||||
cmov
|
cmov
|
||||||
|
conio_h
|
||||||
dcbzl
|
dcbzl
|
||||||
dev_bktr_ioctl_bt848_h
|
dev_bktr_ioctl_bt848_h
|
||||||
dev_bktr_ioctl_meteor_h
|
dev_bktr_ioctl_meteor_h
|
||||||
@ -681,6 +682,7 @@ HAVE_LIST="
|
|||||||
soundcard_h
|
soundcard_h
|
||||||
sys_poll_h
|
sys_poll_h
|
||||||
sys_soundcard_h
|
sys_soundcard_h
|
||||||
|
termios_h
|
||||||
threads
|
threads
|
||||||
"
|
"
|
||||||
|
|
||||||
@ -1510,6 +1512,9 @@ check_header byteswap.h
|
|||||||
|
|
||||||
check_func mkstemp
|
check_func mkstemp
|
||||||
|
|
||||||
|
check_header termios.h
|
||||||
|
check_header conio.h
|
||||||
|
|
||||||
check_header arpa/inet.h
|
check_header arpa/inet.h
|
||||||
|
|
||||||
check_func inet_aton
|
check_func inet_aton
|
||||||
|
14
ffmpeg.c
14
ffmpeg.c
@ -34,9 +34,9 @@
|
|||||||
#include "fifo.h"
|
#include "fifo.h"
|
||||||
#include "avstring.h"
|
#include "avstring.h"
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#if defined(HAVE_CONIO_H)
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
#else
|
#elif defined(HAVE_TERMIOS_H)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -277,7 +277,7 @@ typedef struct AVInputFile {
|
|||||||
int nb_streams; /* nb streams we are aware of */
|
int nb_streams; /* nb streams we are aware of */
|
||||||
} AVInputFile;
|
} AVInputFile;
|
||||||
|
|
||||||
#ifndef __MINGW32__
|
#ifdef HAVE_TERMIOS_H
|
||||||
|
|
||||||
/* init terminal so that we can grab keys */
|
/* init terminal so that we can grab keys */
|
||||||
static struct termios oldtty;
|
static struct termios oldtty;
|
||||||
@ -285,7 +285,7 @@ static struct termios oldtty;
|
|||||||
|
|
||||||
static void term_exit(void)
|
static void term_exit(void)
|
||||||
{
|
{
|
||||||
#ifndef __MINGW32__
|
#ifdef HAVE_TERMIOS_H
|
||||||
tcsetattr (0, TCSANOW, &oldtty);
|
tcsetattr (0, TCSANOW, &oldtty);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -301,7 +301,7 @@ sigterm_handler(int sig)
|
|||||||
|
|
||||||
static void term_init(void)
|
static void term_init(void)
|
||||||
{
|
{
|
||||||
#ifndef __MINGW32__
|
#ifdef HAVE_TERMIOS_H
|
||||||
struct termios tty;
|
struct termios tty;
|
||||||
|
|
||||||
tcgetattr (0, &tty);
|
tcgetattr (0, &tty);
|
||||||
@ -334,10 +334,10 @@ static void term_init(void)
|
|||||||
/* read a key without blocking */
|
/* read a key without blocking */
|
||||||
static int read_key(void)
|
static int read_key(void)
|
||||||
{
|
{
|
||||||
#ifdef __MINGW32__
|
#if defined(HAVE_CONIO_H)
|
||||||
if(kbhit())
|
if(kbhit())
|
||||||
return(getch());
|
return(getch());
|
||||||
#else
|
#elif defined(HAVE_TERMIOS_H)
|
||||||
int n = 1;
|
int n = 1;
|
||||||
unsigned char ch;
|
unsigned char ch;
|
||||||
#ifndef CONFIG_BEOS_NETSERVER
|
#ifndef CONFIG_BEOS_NETSERVER
|
||||||
|
Loading…
Reference in New Issue
Block a user