X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmelt%2Fio.c;h=46b992b96c536cc553610ec77c0fd9914cf528d4;hb=2c046e968db474d1eafbcf77b119495bf89e6ae5;hp=77d13b96881508d1d3b8aa079cb523a446eb414b;hpb=5b0fa837f5e748c62823f7711d5fc1a4d7bc2950;p=mlt diff --git a/src/melt/io.c b/src/melt/io.c index 77d13b96..46b992b9 100644 --- a/src/melt/io.c +++ b/src/melt/io.c @@ -1,5 +1,5 @@ /* - * io.c -- inigo input/output + * io.c -- melt input/output * Copyright (C) 2002-2003 Ushodaya Enterprises Limited * Author: Charles Yates * @@ -27,7 +27,14 @@ #include #include #include +#ifndef WIN32 #include +#else +// MinGW defines struct timespec in pthread.h +#include +// for nanosleep() +#include +#endif #include #include @@ -93,8 +100,10 @@ int *get_int( int *output, int use ) /** This stores the previous settings */ +#ifndef WIN32 static struct termios oldtty; static int mode = 0; +#endif /** This is called automatically on application exit to restore the previous tty settings. @@ -102,11 +111,13 @@ static int mode = 0; void term_exit(void) { +#ifndef WIN32 if ( mode == 1 ) { tcsetattr( 0, TCSANOW, &oldtty ); mode = 0; } +#endif } /** Init terminal so that we can grab keys without blocking. @@ -114,6 +125,7 @@ void term_exit(void) void term_init( ) { +#ifndef WIN32 struct termios tty; tcgetattr( 0, &tty ); @@ -132,6 +144,7 @@ void term_init( ) mode = 1; atexit( term_exit ); +#endif } /** Check for a keypress without blocking infinitely. @@ -140,6 +153,7 @@ void term_init( ) int term_read( ) { +#ifndef WIN32 int n = 1; unsigned char ch; struct timeval tv; @@ -158,6 +172,10 @@ int term_read( ) return ch; return n; } +#else + struct timespec tm = { 0, 40000000 }; + nanosleep( &tm, NULL ); +#endif return -1; }