diff options
author | sr55 <[email protected]> | 2009-06-15 19:06:38 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2009-06-15 19:06:38 +0000 |
commit | c7f4c7ee6076abcb296f01e6ce4f57434800a9fc (patch) | |
tree | 6b16238bead0e8ee710a07753722696dda5906a6 /test | |
parent | 2c712a6cfb15ed667979fd6d9cefc2fca0bb5a81 (diff) |
CLI:
- Fixes keyboard input on the MinGW port. (Thanks Kona)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2537 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'test')
-rw-r--r-- | test/test.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/test/test.c b/test/test.c index 56a3de45d..0e33a6020 100644 --- a/test/test.c +++ b/test/test.c @@ -11,14 +11,18 @@ #include <unistd.h> #include <inttypes.h> -#ifdef PTW32_STATIC_LIB +#if defined( __MINGW32__ ) +#include <conio.h> +#endif + +#if defined( PTW32_STATIC_LIB ) #include <pthread.h> #endif #include "hb.h" #include "parsecsv.h" -#ifdef __APPLE_CC__ +#if defined( __APPLE_CC__ ) #import <CoreServices/CoreServices.h> #include <IOKit/IOKitLib.h> #include <IOKit/storage/IOMedia.h> @@ -171,7 +175,7 @@ int main( int argc, char ** argv ) return 1; } -#ifdef PTW32_STATIC_LIB +#if defined( PTW32_STATIC_LIB ) pthread_win32_process_attach_np(); pthread_win32_thread_attach_np(); #endif @@ -233,7 +237,29 @@ int main( int argc, char ** argv ) /* Wait... */ while( !die ) { -#if !defined(SYS_BEOS) && !defined(__MINGW32__) +#if defined( __MINGW32__ ) + if( _kbhit() ) { + switch( _getch() ) + { + case 0x03: /* ctrl-c */ + case 'q': + fprintf( stdout, "\nEncoding Quit by user command\n" ); + die = 1; + break; + case 'p': + fprintf( stdout, "\nEncoding Paused by user command, 'r' to resume\n" ); + hb_pause( h ); + break; + case 'r': + hb_resume( h ); + break; + case 'h': + ShowCommands(); + break; + } + } + hb_snooze( 200 ); +#elif !defined(SYS_BEOS) fd_set fds; struct timeval tv; int ret; @@ -322,7 +348,7 @@ int main( int argc, char ** argv ) fprintf( stderr, "HandBrake has exited.\n" ); -#ifdef PTW32_STATIC_LIB +#if defined( PTW32_STATIC_LIB ) pthread_win32_thread_detach_np(); pthread_win32_process_detach_np(); #endif |