MCPcopy Create free account
hub / github.com/SatDump/SatDump / process

Method process

plugins/analog_support/noaa_apt/module_noaa_apt_decoder.cpp:71–1011  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 15

getFilesizeFunction · 0.85
parseHeaderFromFileWavFunction · 0.85
isValidWavFunction · 0.85
tryParseFilenameMetadataFunction · 0.85
to_stringFunction · 0.85
image_to_rgbaFunction · 0.85
white_balanceFunction · 0.85
save_imgFunction · 0.85
scale_val_rFunction · 0.85
scale_valFunction · 0.85
loadJsonFileFunction · 0.85
getResourcePathFunction · 0.85

Tested by

no test coverage detected