Fix the sample rate parsing
The byte at offset 0x1A appears to be some settings byte, containing not only the sample rate index, but also some other values in the higher bits. Except for the 4th bit, which contains the salinity setting, the meaning of those higher bits remains unknown. Since the sample rate is limited to only 4 possible values, 2 bits are sufficient for encoding the sample rate index. The 3th bit might contain some other setting, or be reserved for future sample rates.
This commit is contained in:
parent
5cb527d53c
commit
060c0b7215
@ -151,9 +151,10 @@ sporasub_sp2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t
|
||||
return DC_STATUS_DATAFORMAT;
|
||||
|
||||
unsigned int nsamples = array_uint16_le(data);
|
||||
unsigned int settings = data[0x1A];
|
||||
|
||||
// Get the sample interval.
|
||||
unsigned int interval_idx = data[0x1A];
|
||||
unsigned int interval_idx = settings & 0x03;
|
||||
const unsigned int intervals[] = {1, 2, 5, 10};
|
||||
if (interval_idx >= C_ARRAY_SIZE(intervals)) {
|
||||
ERROR (abstract->context, "Invalid sample interval index %u", interval_idx);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user