MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / EventLoop

Function EventLoop

test/test.c:352–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

350static volatile int job_running = 0;
351
352void EventLoop(hb_handle_t *h, hb_dict_t *preset_dict)
353{
354 /* Wait... */
355 work_done = 0;
356 while (!die && !work_done)
357 {
358#if defined( __MINGW32__ )
359 if( _kbhit() ) {
360 switch( _getch() )
361 {
362 case 0x03: /* ctrl-c */
363 case 'q':
364 fprintf( stdout, "\nEncoding Quit by user command\n" );
365 done_error = HB_ERROR_CANCELED;
366 die = 1;
367 break;
368 case 'p':
369 fprintf(stdout,
370 "\nEncoding Paused by user command, 'r' to resume\n");
371 hb_pause(h);
372 hb_system_sleep_allow(h);
373 break;
374 case 'r':
375 hb_system_sleep_prevent(h);
376 hb_resume(h);
377 break;
378 case 'h':
379 ShowCommands();
380 break;
381 }
382 }
383#else
384 fd_set fds;
385 struct timeval tv;
386 int ret;
387 char buf[257];
388
389 tv.tv_sec = 0;
390 tv.tv_usec = 100000;
391
392 FD_ZERO( &fds );
393 FD_SET( STDIN_FILENO, &fds );
394 ret = select( STDIN_FILENO + 1, &fds, NULL, NULL, &tv );
395
396 if( ret > 0 )
397 {
398 int size = 0;
399
400 while( size < 256 &&
401 read( STDIN_FILENO, &buf[size], 1 ) > 0 )
402 {
403 if( buf[size] == '\n' )
404 {
405 break;
406 }
407 size++;
408 }
409

Callers 2

RunQueueJobFunction · 0.85
mainFunction · 0.85

Calls 7

hb_pauseFunction · 0.85
hb_system_sleep_allowFunction · 0.85
hb_system_sleep_preventFunction · 0.85
hb_resumeFunction · 0.85
ShowCommandsFunction · 0.85
hb_snoozeFunction · 0.85
HandleEventsFunction · 0.85

Tested by

no test coverage detected