summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBradley Sepos <[email protected]>2017-06-19 19:13:21 -0400
committerBradley Sepos <[email protected]>2017-06-19 19:13:21 -0400
commit148591c7223ead48f1b2498e689ede7c789a2997 (patch)
tree3a6cfbf65aae05fa1aaad55d32a5c7c18c1d6754
parent1ee85956e293ec15bcd1a97e75aae387124c57db (diff)
cli: Fix regression in a5450860.
-rw-r--r--test/test.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/test.c b/test/test.c
index 4356950e5..cbfff7963 100644
--- a/test/test.c
+++ b/test/test.c
@@ -339,6 +339,58 @@ void EventLoop(hb_handle_t *h, hb_dict_t *preset_dict)
break;
}
}
+#else
+ fd_set fds;
+ struct timeval tv;
+ int ret;
+ char buf[257];
+
+ tv.tv_sec = 0;
+ tv.tv_usec = 100000;
+
+ FD_ZERO( &fds );
+ FD_SET( STDIN_FILENO, &fds );
+ ret = select( STDIN_FILENO + 1, &fds, NULL, NULL, &tv );
+
+ if( ret > 0 )
+ {
+ int size = 0;
+
+ while( size < 256 &&
+ read( STDIN_FILENO, &buf[size], 1 ) > 0 )
+ {
+ if( buf[size] == '\n' )
+ {
+ break;
+ }
+ size++;
+ }
+
+ if( size >= 256 || buf[size] == '\n' )
+ {
+ switch( buf[0] )
+ {
+ case 'q':
+ fprintf( stdout, "\nEncoding Quit by user command\n" );
+ done_error = HB_ERROR_CANCELED;
+ die = 1;
+ break;
+ case 'p':
+ fprintf(stdout,
+ "\nEncoding Paused by user command, 'r' to resume\n");
+ hb_pause(h);
+ hb_system_sleep_allow(h);
+ break;
+ case 'r':
+ hb_system_sleep_prevent(h);
+ hb_resume(h);
+ break;
+ case 'h':
+ ShowCommands();
+ break;
+ }
+ }
+ }
#endif
if (stdout_tty == 0)
{