aboutsummaryrefslogtreecommitdiffstats
path: root/lib/edi/STIDecoder.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2024-07-22 16:27:11 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2024-07-22 16:27:11 +0200
commit6295e9f75bb1408292be2e27a816b23dfc2ec589 (patch)
tree92b5652a76508f1081a36e335f3fbae1a7323cf7 /lib/edi/STIDecoder.cpp
parentc055764200393e4f2ce48daea7d175fd6af26b72 (diff)
downloaddabmux-6295e9f75bb1408292be2e27a816b23dfc2ec589.tar.gz
dabmux-6295e9f75bb1408292be2e27a816b23dfc2ec589.tar.bz2
dabmux-6295e9f75bb1408292be2e27a816b23dfc2ec589.zip
Common: Add STI stream index filter
Diffstat (limited to 'lib/edi/STIDecoder.cpp')
-rw-r--r--lib/edi/STIDecoder.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/edi/STIDecoder.cpp b/lib/edi/STIDecoder.cpp
index d387f1e..2de828b 100644
--- a/lib/edi/STIDecoder.cpp
+++ b/lib/edi/STIDecoder.cpp
@@ -70,6 +70,12 @@ void STIDecoder::setMaxDelay(int num_af_packets)
m_dispatcher.setMaxDelay(num_af_packets);
}
+void STIDecoder::filter_stream_index(bool enable, uint16_t index)
+{
+ m_filter_stream = enable;
+ m_filtered_stream_index = index;
+}
+
#define AFPACKET_HEADER_LEN 10 // includes SYNC
bool STIDecoder::decode_starptr(const std::vector<uint8_t>& value, const tag_name_t& /*n*/)
@@ -173,6 +179,14 @@ bool STIDecoder::decode_ssn(const std::vector<uint8_t>& value, const tag_name_t&
n = (uint16_t)(name[2]) << 8;
n |= (uint16_t)(name[3]);
+ if (n == 0) {
+ etiLog.level(warn) << "EDI: Stream index SSnn tag is zero";
+ }
+
+ if (m_filter_stream and m_filtered_stream_index != n) {
+ return true;
+ }
+
sti.stream_index = n - 1; // n is 1-indexed
sti.rfa = value[0] >> 3;
sti.tid = value[0] & 0x07;