| 503 | } |
| 504 | |
| 505 | int main( int argc, char ** argv ) |
| 506 | { |
| 507 | hb_handle_t * h; |
| 508 | |
| 509 | hb_global_init(); |
| 510 | hb_presets_builtin_update(); |
| 511 | hb_presets_cli_default_init(); |
| 512 | |
| 513 | /* Init libhb */ |
| 514 | h = hb_init(4); // Show all logging until debug level is parsed |
| 515 | |
| 516 | test_tty(); // Terminal detection |
| 517 | |
| 518 | // Get utf8 command line if windows |
| 519 | get_argv_utf8(&argc, &argv); |
| 520 | |
| 521 | /* Parse command line */ |
| 522 | if( ParseOptions( argc, argv ) || |
| 523 | CheckOptions( argc, argv ) ) |
| 524 | { |
| 525 | hb_log_level_set(h, debug); |
| 526 | goto cleanup; |
| 527 | } |
| 528 | |
| 529 | hb_log_level_set(h, debug); |
| 530 | |
| 531 | /* Register our error handler */ |
| 532 | hb_register_error_handler(&hb_cli_error_handler); |
| 533 | |
| 534 | hb_dvd_set_dvdnav( dvdnav ); |
| 535 | |
| 536 | /* Show version */ |
| 537 | fprintf( stderr, "%s - %s - %s\n", |
| 538 | HB_PROJECT_TITLE, HB_PROJECT_HOST_TITLE, HB_PROJECT_URL_WEBSITE ); |
| 539 | |
| 540 | /* Geeky */ |
| 541 | fprintf( stderr, "%d CPU%s detected\n", hb_get_cpu_count(), |
| 542 | hb_get_cpu_count() > 1 ? "s" : "" ); |
| 543 | |
| 544 | /* Exit ASAP on Ctrl-C */ |
| 545 | signal( SIGINT, SigHandler ); |
| 546 | |
| 547 | if (queue_import_name != NULL) |
| 548 | { |
| 549 | hb_system_sleep_prevent(h); |
| 550 | if (RunQueue(h, queue_import_name)) |
| 551 | { |
| 552 | done_error = HB_ERROR_WRONG_INPUT; |
| 553 | goto cleanup; |
| 554 | } |
| 555 | } |
| 556 | else |
| 557 | { |
| 558 | // Apply all command line overrides to the preset that are possible. |
| 559 | // Some command line options are applied later to the job |
| 560 | // (e.g. chapter names, explicit audio & subtitle tracks). |
| 561 | hb_dict_t *preset_dict = PreparePreset(preset_name); |
| 562 | if (preset_dict == NULL) |
nothing calls this directly
no test coverage detected