Update to version 3.2

This commit is contained in:
2026-03-18 14:56:42 +01:00
parent f593487c77
commit 44609d367f
49 changed files with 12657 additions and 3668 deletions

View File

@@ -35,8 +35,11 @@ namespace CAPS {
class Encoder {
public:
Encoder(int freqn, int freqd) : _clk(freqn, freqd),
_sampleCount(0), _timingQuality(-1) {}
Encoder(int freqn, int freqd)
: _clk(freqn, freqd)
, _sampleCount(0), _timingQuality(-1)
, _context{nullptr} {}
virtual ~Encoder() {}
virtual void push(void *sample) = 0;
@@ -49,13 +52,18 @@ class Encoder {
void setStartTime(const Time &time) { _clk.syncTime(time); }
const Time currentTime() const { return _clk.getTime(0); }
int timingQuality() { return _timingQuality; }
void setTimingQuality(int quality) { _timingQuality = quality; }
int timingQuality() { return _timingQuality; }
void setContext(void *context) { _context = context; }
PacketPtr pop() {
if ( _packetQueue.empty() ) return PacketPtr();
if ( _packetQueue.empty() ) {
return PacketPtr();
}
PacketPtr rec = _packetQueue.front();
rec->context = _context;
_packetQueue.pop_front();
return rec;
}
@@ -66,6 +74,7 @@ class Encoder {
int _sampleCount;
PacketQueue _packetQueue;
int _timingQuality;
void *_context;
};
}

View File

@@ -143,10 +143,9 @@ MSEEDDataRecord *MSEEDFormat::getBuffer(const Time &it, int usec_correction,
void MSEEDFormat::updateBuffer(MSEEDDataRecord *rec, int samples, int frames) {
sl_fsdh_s* fsdh = (sl_fsdh_s *)rec->data()->data();
char temp[7];
char temp[6] = { 0, 0, 0, 0, 0, 0 };
sprintf(temp, "%06d", (int)0);
memcpy(fsdh->sequence_number,temp,6);
memcpy(fsdh->sequence_number, temp, 6);
fsdh->dhq_indicator = 'D';
fsdh->num_samples = htons(samples);
@@ -157,6 +156,8 @@ void MSEEDFormat::updateBuffer(MSEEDDataRecord *rec, int samples, int frames) {
sizeof(sl_fsdh_s) + sizeof(sl_blkt_1000_s));
blkt_1001->frame_cnt = frames;
}
rec->unpackHeader();
}

View File

@@ -36,12 +36,12 @@ Steim1Encoder<T>::~Steim1Encoder() {
template<typename T>
void Steim1Encoder<T>::updateSpw(int bp) {
int spw1 = 4;
int spw = 4;
assert(bp < 4);
if ( _buf[bp] < -32768 || _buf[bp] > 32767 ) spw1 = 1;
else if ( _buf[bp] < -128 || _buf[bp] > 127 ) spw1 = 2;
if ( spw1 < _spw ) _spw = spw1;
if ( _buf[bp] < -32768 || _buf[bp] > 32767 ) spw = 1;
else if ( _buf[bp] < -128 || _buf[bp] > 127 ) spw = 2;
if ( spw < _spw ) _spw = spw;
}
template<typename T>

View File

@@ -38,36 +38,36 @@ template<typename T> Steim2Encoder<T>::~Steim2Encoder() {
}
template<typename T> void Steim2Encoder<T>::updateSpw(int bp) {
assert(_bp < 7);
assert(bp < 7);
if ( _buf[_bp] < -536870912 ) {
if ( _buf[bp] < -536870912 ) {
CAPS_WARNING("%s.%s.%s.%s: value %d is too large for Steim2 encoding",
_format->networkCode.c_str(), _format->stationCode.c_str(),
_format->locationCode.c_str(), _format->channelCode.c_str(),
_buf[_bp]);
_buf[_bp] = -536870912;
_buf[bp]);
_buf[bp] = -536870912;
_spw = 1;
return;
}
if ( _buf[_bp] > 536870911 ) {
if ( _buf[bp] > 536870911 ) {
CAPS_WARNING("%s.%s.%s.%s: value %d is too large for Steim2 encoding",
_format->networkCode.c_str(), _format->stationCode.c_str(),
_format->locationCode.c_str(), _format->channelCode.c_str(),
_buf[_bp]);
_buf[_bp] = 536870911;
_buf[bp]);
_buf[bp] = 536870911;
_spw = 1;
return;
}
int spw1 = 7;
if ( _buf[_bp] < -16384 || _buf[_bp] > 16383 ) spw1 = 1;
else if ( _buf[_bp] < -512 || _buf[_bp] > 511 ) spw1 = 2;
else if ( _buf[_bp] < -128 || _buf[_bp] > 127 ) spw1 = 3;
else if ( _buf[_bp] < -32 || _buf[_bp] > 31 ) spw1 = 4;
else if ( _buf[_bp] < -16 || _buf[_bp] > 15 ) spw1 = 5;
else if ( _buf[_bp] < -8 || _buf[_bp] > 7 ) spw1 = 6;
if ( spw1 < _spw ) _spw = spw1;
int spw = 7;
if ( _buf[bp] < -16384 || _buf[bp] > 16383 ) spw = 1;
else if ( _buf[bp] < -512 || _buf[bp] > 511 ) spw = 2;
else if ( _buf[bp] < -128 || _buf[bp] > 127 ) spw = 3;
else if ( _buf[bp] < -32 || _buf[bp] > 31 ) spw = 4;
else if ( _buf[bp] < -16 || _buf[bp] > 15 ) spw = 5;
else if ( _buf[bp] < -8 || _buf[bp] > 7 ) spw = 6;
if ( spw < _spw ) _spw = spw;
}
template<typename T> void Steim2Encoder<T>::store(int32_t value) {