| 1099 | } |
| 1100 | |
| 1101 | static int sanitize_audio(hb_job_t *job) |
| 1102 | { |
| 1103 | int i; |
| 1104 | hb_audio_t * audio; |
| 1105 | |
| 1106 | if (job->indepth_scan) |
| 1107 | { |
| 1108 | // Audio is not processed during subtitle scan |
| 1109 | return 0; |
| 1110 | } |
| 1111 | |
| 1112 | // apply Auto Passthru settings |
| 1113 | hb_autopassthru_apply_settings(job); |
| 1114 | |
| 1115 | for (i = 0; i < hb_list_count(job->list_audio);) |
| 1116 | { |
| 1117 | audio = hb_list_item(job->list_audio, i); |
| 1118 | if (audio->config.out.codec == HB_ACODEC_AUTO_PASS) |
| 1119 | { |
| 1120 | // Auto Passthru should have been handled above |
| 1121 | // remove track to avoid a crash |
| 1122 | hb_log("Auto Passthru error, dropping track %d", |
| 1123 | audio->config.out.track); |
| 1124 | hb_list_rem(job->list_audio, audio); |
| 1125 | free(audio); |
| 1126 | continue; |
| 1127 | } |
| 1128 | if ((audio->config.out.codec & HB_ACODEC_PASS_FLAG) && |
| 1129 | !(audio->config.in.codec & |
| 1130 | audio->config.out.codec & HB_ACODEC_PASS_MASK)) |
| 1131 | { |
| 1132 | hb_log("Passthru requested and input codec is not the same as output codec for track %d, dropping track", |
| 1133 | audio->config.out.track); |
| 1134 | hb_list_rem(job->list_audio, audio); |
| 1135 | free(audio); |
| 1136 | continue; |
| 1137 | } |
| 1138 | /* |
| 1139 | * never properly tested w/resampling |
| 1140 | * causes HandBrake GitHub issue #3533 |
| 1141 | */ |
| 1142 | if (audio->config.out.mixdown == HB_AMIXDOWN_RIGHT || |
| 1143 | audio->config.out.mixdown == HB_AMIXDOWN_LEFT) |
| 1144 | { |
| 1145 | if (audio->config.in.samplerate != |
| 1146 | hb_audio_samplerate_find_closest(audio->config.in.samplerate, |
| 1147 | audio->config.out.codec)) |
| 1148 | { |
| 1149 | // e.g. >48 kHz input, encoder w/out >48 kHz support (currently all encoders, libhb limitation) |
| 1150 | hb_log("work: unsupported samplerate %d for mixdown %s, dropping track %d", |
| 1151 | audio->config.in.samplerate, |
| 1152 | hb_mixdown_get_name(audio->config.out.mixdown), |
| 1153 | audio->config.out.track); |
| 1154 | hb_list_rem(job->list_audio, audio); |
| 1155 | free(audio); |
| 1156 | continue; |
| 1157 | } |
| 1158 | if (audio->config.out.samplerate > 0 && |
no test coverage detected