* The following code is the main loop of the file converter */
| 885 | * The following code is the main loop of the file converter |
| 886 | */ |
| 887 | static int transcode(Scheduler *sch) |
| 888 | { |
| 889 | int ret = 0; |
| 890 | int64_t timer_start, transcode_ts = 0; |
| 891 | |
| 892 | print_stream_maps(); |
| 893 | |
| 894 | atomic_store(&transcode_init_done, 1); |
| 895 | |
| 896 | ret = sch_start(sch); |
| 897 | if (ret < 0) |
| 898 | return ret; |
| 899 | |
| 900 | if (stdin_interaction) { |
| 901 | av_log(NULL, AV_LOG_INFO, "Press [q] to stop, [?] for help\n"); |
| 902 | } |
| 903 | |
| 904 | timer_start = av_gettime_relative(); |
| 905 | |
| 906 | while (!sch_wait(sch, stats_period, &transcode_ts)) { |
| 907 | int64_t cur_time= av_gettime_relative(); |
| 908 | |
| 909 | if (received_nb_signals) |
| 910 | break; |
| 911 | |
| 912 | /* if 'q' pressed, exits */ |
| 913 | if (stdin_interaction) |
| 914 | if (check_keyboard_interaction(cur_time) < 0) |
| 915 | break; |
| 916 | |
| 917 | /* dump report by using the output first video and audio streams */ |
| 918 | print_report(0, timer_start, cur_time, transcode_ts); |
| 919 | } |
| 920 | |
| 921 | ret = sch_stop(sch, &transcode_ts); |
| 922 | |
| 923 | /* write the trailer if needed */ |
| 924 | for (int i = 0; i < nb_output_files; i++) { |
| 925 | int err = of_write_trailer(output_files[i]); |
| 926 | ret = err_merge(ret, err); |
| 927 | } |
| 928 | |
| 929 | term_exit(); |
| 930 | |
| 931 | /* dump report by using the first video and audio streams */ |
| 932 | print_report(1, timer_start, av_gettime_relative(), transcode_ts); |
| 933 | |
| 934 | return ret; |
| 935 | } |
| 936 | |
| 937 | static BenchmarkTimeStamps get_benchmark_time_stamps(void) |
| 938 | { |
no test coverage detected