| 5019 | } |
| 5020 | |
| 5021 | static hb_dict_t* |
| 5022 | PrepareJob(hb_handle_t *h, hb_title_t *title, hb_dict_t *preset_dict) |
| 5023 | { |
| 5024 | hb_dict_t *job_dict; |
| 5025 | job_dict = hb_preset_job_init(h, title->index, preset_dict); |
| 5026 | if (job_dict == NULL) |
| 5027 | { |
| 5028 | fprintf(stderr, "Failed to initialize job\n"); |
| 5029 | return NULL; |
| 5030 | } |
| 5031 | |
| 5032 | hb_dict_t *dest_dict = hb_dict_get(job_dict, "Destination"); |
| 5033 | if (hb_value_get_bool(hb_dict_get(dest_dict, "ChapterMarkers"))) |
| 5034 | { |
| 5035 | write_chapter_names(job_dict, marker_file); |
| 5036 | } |
| 5037 | |
| 5038 | hb_dict_set(dest_dict, "File", hb_value_string(output)); |
| 5039 | |
| 5040 | // Now that the job is initialized, we need to find out |
| 5041 | // what muxer is being used. |
| 5042 | mux = hb_container_get_from_name( |
| 5043 | hb_value_get_string(hb_dict_get(dest_dict, "Mux"))); |
| 5044 | |
| 5045 | // Now set non-preset settings in the job dict |
| 5046 | int64_t range_start = 0, range_end = 0, range_seek_points = 0; |
| 5047 | const char *range_type = "chapter"; |
| 5048 | if (chapter_start && chapter_end && |
| 5049 | !start_at_pts && !stop_at_pts && |
| 5050 | !start_at_frame && !stop_at_frame && |
| 5051 | !start_at_preview ) |
| 5052 | { |
| 5053 | range_type = "chapter"; |
| 5054 | int chapter_count = hb_list_count(title->list_chapter); |
| 5055 | range_start = MAX(1, chapter_start); |
| 5056 | range_end = MAX(chapter_start, MIN(chapter_count, chapter_end)); |
| 5057 | } |
| 5058 | else if (start_at_preview) |
| 5059 | { |
| 5060 | range_type = "preview"; |
| 5061 | range_start = start_at_preview -1; |
| 5062 | range_end = stop_at_pts; |
| 5063 | range_seek_points = preview_count; |
| 5064 | } |
| 5065 | else if (start_at_pts || stop_at_pts) |
| 5066 | { |
| 5067 | range_type = "time"; |
| 5068 | range_start = start_at_pts; |
| 5069 | if (stop_at_pts > 0) |
| 5070 | range_end = start_at_pts + stop_at_pts; |
| 5071 | } |
| 5072 | else if (start_at_frame || stop_at_frame) |
| 5073 | { |
| 5074 | range_type = "frame"; |
| 5075 | range_start = start_at_frame; |
| 5076 | if (stop_at_frame > 0) |
| 5077 | { |
| 5078 | if (start_at_frame > 0) |
no test coverage detected