diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-02-17 12:26:28 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-02-17 12:26:28 +0100 |
commit | c6ddb4451138005bbf678ee75d6de690a165faa2 (patch) | |
tree | c831f55fc1bd1f371a270034f2b46bc4ebc94e0d | |
parent | cf26226714f73ce0d2b833bc579dbb00b9297d88 (diff) | |
download | dabmod-c6ddb4451138005bbf678ee75d6de690a165faa2.tar.gz dabmod-c6ddb4451138005bbf678ee75d6de690a165faa2.tar.bz2 dabmod-c6ddb4451138005bbf678ee75d6de690a165faa2.zip |
Update EDI lib: fix SAD and take latest changes
-rw-r--r-- | lib/edi/ETIDecoder.cpp | 3 | ||||
-rw-r--r-- | lib/edi/ETIDecoder.hpp | 4 | ||||
-rw-r--r-- | lib/edi/PFT.cpp | 20 | ||||
-rw-r--r-- | lib/edi/PFT.hpp | 26 | ||||
-rw-r--r-- | src/DabMod.cpp | 2 |
5 files changed, 33 insertions, 22 deletions
diff --git a/lib/edi/ETIDecoder.cpp b/lib/edi/ETIDecoder.cpp index 78e0ea6..ffc17a4 100644 --- a/lib/edi/ETIDecoder.cpp +++ b/lib/edi/ETIDecoder.cpp @@ -30,10 +30,11 @@ namespace EdiDecoder { using namespace std; -ETIDecoder::ETIDecoder(DataCollector& data_collector) : +ETIDecoder::ETIDecoder(DataCollector& data_collector, bool verbose) : m_data_collector(data_collector), m_last_seq(0) { + m_pft.setVerbose(verbose); } void ETIDecoder::push_bytes(const vector<uint8_t> &buf) diff --git a/lib/edi/ETIDecoder.hpp b/lib/edi/ETIDecoder.hpp index 9624c48..37a564f 100644 --- a/lib/edi/ETIDecoder.hpp +++ b/lib/edi/ETIDecoder.hpp @@ -49,7 +49,7 @@ struct eti_fc_data { struct eti_stc_data { uint8_t stream_index; uint8_t scid; - uint8_t sad; + uint16_t sad; uint8_t tpl; std::vector<uint8_t> mst; @@ -101,7 +101,7 @@ class DataCollector { */ class ETIDecoder { public: - ETIDecoder(DataCollector& data_collector); + ETIDecoder(DataCollector& data_collector, bool verbose); /* Push bytes into the decoder. The buf can contain more * than a single packet. This is useful when reading from streams diff --git a/lib/edi/PFT.cpp b/lib/edi/PFT.cpp index 4348f14..aff7929 100644 --- a/lib/edi/PFT.cpp +++ b/lib/edi/PFT.cpp @@ -488,14 +488,15 @@ void PFT::pushPFTFrag(const Fragment &fragment) auto& p = m_afbuilders.at(fragment.Pseq()); p.pushPFTFrag(fragment); -#if 0 - etiLog.log(debug, "Got frag %u:%u, afbuilders: ", - fragment.Pseq(), fragment.Findex()); - for (const auto &k : m_afbuilders) { - const bool isNextPseq = (m_next_pseq == k.first); - etiLog.level(debug) << (isNextPseq ? "->" : " ") << k.first << " " << k.second.visualise(); + if (m_verbose) { + etiLog.log(debug, "Got frag %u:%u, afbuilders: ", + fragment.Pseq(), fragment.Findex()); + for (const auto &k : m_afbuilders) { + const bool isNextPseq = (m_next_pseq == k.first); + etiLog.level(debug) << (isNextPseq ? "->" : " ") << + k.first << " " << k.second.visualise(); + } } -#endif } @@ -555,6 +556,11 @@ void PFT::setMaxDelay(size_t num_af_packets) m_max_delay = num_af_packets; } +void PFT::setVerbose(bool enable) +{ + m_verbose = enable; +} + void PFT::incrementNextPseq() { if (m_afbuilders.count(m_next_pseq - NUM_AFBUILDERS_TO_KEEP) > 0) { diff --git a/lib/edi/PFT.hpp b/lib/edi/PFT.hpp index 1a2f617..779509b 100644 --- a/lib/edi/PFT.hpp +++ b/lib/edi/PFT.hpp @@ -58,17 +58,17 @@ class Fragment private: std::vector<uint8_t> _payload; - pseq_t _Pseq; - findex_t _Findex; - findex_t _Fcount; - bool _FEC; - bool _Addr; - uint16_t _Plen; - uint8_t _RSk; - uint8_t _RSz; - uint16_t _Source; - uint16_t _Dest; - bool _valid; + pseq_t _Pseq = 0; + findex_t _Findex = 0; + findex_t _Fcount = 0; + bool _FEC = false; + bool _Addr = false; + uint16_t _Plen = 0; + uint8_t _RSk = 0; + uint8_t _RSz = 0; + uint16_t _Source = 0; + uint16_t _Dest = 0; + bool _valid = false; }; /* The AFBuilder collects Fragments and builds an Application Frame @@ -146,6 +146,9 @@ class PFT */ void setMaxDelay(size_t num_af_packets); + /* Enable verbose fprintf */ + void setVerbose(bool enable); + private: void incrementNextPseq(void); @@ -155,6 +158,7 @@ class PFT // Keep one AFBuilder for each Pseq std::map<pseq_t, AFBuilder> m_afbuilders; + bool m_verbose = 0; }; } diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 9cb25a3..526670d 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -702,7 +702,7 @@ int launch_modulator(int argc, char* argv[]) EdiReader ediReader(tist_offset_s, tist_delay_stages); - EdiDecoder::ETIDecoder ediInput(ediReader); + EdiDecoder::ETIDecoder ediInput(ediReader, false); if (edi_max_delay_ms > 0.0f) { // setMaxDelay wants number of AF packets, which correspond to 24ms ETI frames ediInput.setMaxDelay(lroundf(edi_max_delay_ms / 24.0f)); |