| 69 | } |
| 70 | |
| 71 | void NOAAAPTDecoderModule::process() |
| 72 | { |
| 73 | if (input_data_type == DATA_FILE) |
| 74 | filesize = getFilesize(d_input_file); |
| 75 | else |
| 76 | filesize = 0; |
| 77 | |
| 78 | std::string main_dir = d_output_file_hint.substr(0, d_output_file_hint.rfind('/')); |
| 79 | |
| 80 | bool is_stereo = false; |
| 81 | |
| 82 | int autodetected_sat = -1; |
| 83 | |
| 84 | std::ifstream data_in; |
| 85 | if (input_data_type == DATA_FILE) |
| 86 | { |
| 87 | wav::WavHeader hdr = wav::parseHeaderFromFileWav(d_input_file); |
| 88 | if (!wav::isValidWav(hdr)) |
| 89 | throw satdump_exception("File is not WAV!"); |
| 90 | if (hdr.bits_per_sample != 16) |
| 91 | throw satdump_exception("Only 16-bits WAV are supported!"); |
| 92 | d_audio_samplerate = hdr.samplerate; |
| 93 | is_stereo = hdr.channel_cnt == 2; |
| 94 | if (is_stereo) |
| 95 | logger->info("File is stereo. Ignoring second channel!"); |
| 96 | |
| 97 | wav::FileMetadata md = wav::tryParseFilenameMetadata(d_input_file, true); |
| 98 | if (md.timestamp != 0 && (d_parameters.contains("start_timestamp") ? d_parameters["start_timestamp"] == -1 : 1)) |
| 99 | { |
| 100 | d_parameters["start_timestamp"] = md.timestamp; |
| 101 | logger->trace("Has timestamp %d", md.timestamp); |
| 102 | } |
| 103 | else |
| 104 | { |
| 105 | logger->warn("Couldn't automatically determine the timestamp, in case of unexpected results, please verify you have specified the correct timestamp manually"); |
| 106 | } |
| 107 | |
| 108 | if (md.frequency == 0 && d_parameters.contains("frequency")) |
| 109 | md.frequency = d_parameters["frequency"].get<uint64_t>(); |
| 110 | |
| 111 | logger->trace("Freq from meta : %llu", md.frequency); |
| 112 | |
| 113 | if (abs(md.frequency - 137.1e6) < 1e4) |
| 114 | { |
| 115 | autodetected_sat = 19; |
| 116 | logger->info("Detected NOAA-19"); |
| 117 | } |
| 118 | else if (abs(md.frequency - 137.9125e6) < 1e4) |
| 119 | { |
| 120 | autodetected_sat = 18; |
| 121 | logger->info("Detected NOAA-18"); |
| 122 | } |
| 123 | else if (abs(md.frequency - 137.62e6) < 1e4) |
| 124 | { |
| 125 | autodetected_sat = 15; |
| 126 | logger->info("Detected NOAA-15"); |
| 127 | } |
| 128 | else |
nothing calls this directly
no test coverage detected