From 01c9b7f1c22b26ddcafc7972c752b43a865a0374 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 22 Feb 2023 06:14:11 +0100 Subject: [PATCH] adds support for FTR chunk type 0 --- .../scviewer/database/ftr/FtrDbLoader.java | 18 +++++++++++++----- .../inputs/my_db.ftr | Bin 1774 -> 1793 bytes 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java index d2f0ba0..7d97f91 100644 --- a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java @@ -97,9 +97,8 @@ public class FtrDbLoader implements IWaveformDbLoader { /** The pcs. */ protected PropertyChangeSupport pcs = new PropertyChangeSupport(this); - /** The Constant x. */ - static final byte[] x = "scv_tr_stream".getBytes(); - + long time_scale_factor = 1000l; + /** * Adds the property change listener. * @@ -319,6 +318,15 @@ public class FtrDbLoader implements IWaveformDbLoader { long tag = readTag(); switch((int)tag) { 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; case 8: { // dictionary uncompressed parseDict(new CborDecoder(new ByteArrayInputStream(readByteString()))); @@ -413,8 +421,8 @@ public class FtrDbLoader implements IWaveformDbLoader { assert(len==4); long txId = cborDecoder.readInt(); long genId = cborDecoder.readInt(); - long startTime = cborDecoder.readInt()*1000; //TODO: scale based on info - long endTime = cborDecoder.readInt()*1000; //TODO: scale based on info + long startTime = cborDecoder.readInt()*loader.time_scale_factor; + long endTime = cborDecoder.readInt()*loader.time_scale_factor; TxGenerator gen = loader.txGenerators.get(genId); FtrTx scvTx = new FtrTx(txId, gen.stream.getId(), genId, startTime, endTime, blockId, blockOffset); loader.maxTime = loader.maxTime > scvTx.endTime ? loader.maxTime : scvTx.endTime; diff --git a/tests/com.minres.scviewer.database.test/inputs/my_db.ftr b/tests/com.minres.scviewer.database.test/inputs/my_db.ftr index 077592e2a9030aefa9b7223850182bfde04512bc..0a27de03071bc1c3ee946676e386eb7dfbdc1e40 100644 GIT binary patch delta 32 ocmaFI+sG$=^XB*Y#{!!fr5P9)UR+r!z;IA1`KwXjMwVA>0O&3aYybcN delta 13 VcmZqVd&kRi^XB*Y8^vF-0RSwa29E#$