| 877 | } |
| 878 | |
| 879 | static int HandleEvents(hb_handle_t * h, hb_dict_t *preset_dict) |
| 880 | { |
| 881 | hb_state_t s; |
| 882 | |
| 883 | hb_get_state( h, &s ); |
| 884 | switch( s.state ) |
| 885 | { |
| 886 | case HB_STATE_IDLE: |
| 887 | /* Nothing to do */ |
| 888 | break; |
| 889 | |
| 890 | #define p s.param.scanning |
| 891 | case HB_STATE_SCANNING: |
| 892 | /* Show what title is currently being scanned */ |
| 893 | if (json) |
| 894 | { |
| 895 | show_progress_json(&s); |
| 896 | break; |
| 897 | } |
| 898 | if (p.preview_cur) |
| 899 | { |
| 900 | fprintf(stderr, "%sScanning title %d of %d, preview %d, %.2f %%", |
| 901 | stderr_sep, p.title_cur, p.title_count, p.preview_cur, 100 * p.progress); |
| 902 | } |
| 903 | else |
| 904 | { |
| 905 | fprintf(stderr, "%sScanning title %d of %d, %.2f %%", |
| 906 | stderr_sep, p.title_cur, p.title_count, 100 * p.progress); |
| 907 | } |
| 908 | fflush(stderr); |
| 909 | break; |
| 910 | #undef p |
| 911 | |
| 912 | case HB_STATE_SCANDONE: |
| 913 | { |
| 914 | hb_title_set_t * title_set; |
| 915 | hb_title_t * title; |
| 916 | |
| 917 | if (job_running) |
| 918 | { |
| 919 | // SCANDONE generated by a scan during execution of the job |
| 920 | break; |
| 921 | } |
| 922 | title_set = hb_get_title_set( h ); |
| 923 | if( !title_set || !hb_list_count( title_set->list_title ) ) |
| 924 | { |
| 925 | /* No valid title, stop right there */ |
| 926 | fprintf( stderr, "No title found.\n" ); |
| 927 | done_error = HB_ERROR_WRONG_INPUT; |
| 928 | die = 1; |
| 929 | break; |
| 930 | } |
| 931 | if (main_feature) |
| 932 | { |
| 933 | int i; |
| 934 | int main_feature_idx=0; |
| 935 | int main_feature_pos=-1; |
| 936 | int main_feature_time=0; |
no test coverage detected