adds support for FTR chunk type 0

This commit is contained in:
Eyck Jentzsch 2023-02-22 06:14:11 +01:00
parent f7f512a5f3
commit 01c9b7f1c2
2 changed files with 13 additions and 5 deletions

View File

@ -97,9 +97,8 @@ public class FtrDbLoader implements IWaveformDbLoader {
/** The pcs. */ /** The pcs. */
protected PropertyChangeSupport pcs = new PropertyChangeSupport(this); protected PropertyChangeSupport pcs = new PropertyChangeSupport(this);
/** The Constant x. */ long time_scale_factor = 1000l;
static final byte[] x = "scv_tr_stream".getBytes();
/** /**
* Adds the property change listener. * Adds the property change listener.
* *
@ -319,6 +318,15 @@ public class FtrDbLoader implements IWaveformDbLoader {
long tag = readTag(); long tag = readTag();
switch((int)tag) { switch((int)tag) {
case 6: // info case 6: // info
CborDecoder cbd = new CborDecoder(new ByteArrayInputStream(readByteString()));
long sz = cbd.readArrayLength();
assert(sz==3);
long time_numerator=cbd.readInt();
long time_denominator=cbd.readInt();
loader.time_scale_factor = 1000000000000000l*time_numerator/time_denominator;
long epoch_tag = cbd.readTag();
assert(epoch_tag==1);
cbd.readInt(); // epoch
break; break;
case 8: { // dictionary uncompressed case 8: { // dictionary uncompressed
parseDict(new CborDecoder(new ByteArrayInputStream(readByteString()))); parseDict(new CborDecoder(new ByteArrayInputStream(readByteString())));
@ -413,8 +421,8 @@ public class FtrDbLoader implements IWaveformDbLoader {
assert(len==4); assert(len==4);
long txId = cborDecoder.readInt(); long txId = cborDecoder.readInt();
long genId = cborDecoder.readInt(); long genId = cborDecoder.readInt();
long startTime = cborDecoder.readInt()*1000; //TODO: scale based on info long startTime = cborDecoder.readInt()*loader.time_scale_factor;
long endTime = cborDecoder.readInt()*1000; //TODO: scale based on info long endTime = cborDecoder.readInt()*loader.time_scale_factor;
TxGenerator gen = loader.txGenerators.get(genId); TxGenerator gen = loader.txGenerators.get(genId);
FtrTx scvTx = new FtrTx(txId, gen.stream.getId(), genId, startTime, endTime, blockId, blockOffset); FtrTx scvTx = new FtrTx(txId, gen.stream.getId(), genId, startTime, endTime, blockId, blockOffset);
loader.maxTime = loader.maxTime > scvTx.endTime ? loader.maxTime : scvTx.endTime; loader.maxTime = loader.maxTime > scvTx.endTime ? loader.maxTime : scvTx.endTime;