aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-03-01 12:32:58 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-03-01 12:32:58 +0100
commit5488092a1e1437a0b22fc0129944978506f520bd (patch)
tree2986aefb2c23a32db33ab7135fc2e218274057e5 /src
parent04c4679074e505adcdd1611676baab0c06466934 (diff)
downloaddabmux-5488092a1e1437a0b22fc0129944978506f520bd.tar.gz
dabmux-5488092a1e1437a0b22fc0129944978506f520bd.tar.bz2
dabmux-5488092a1e1437a0b22fc0129944978506f520bd.zip
Check FI size at startup because we don't auto-split the lists
Diffstat (limited to 'src')
-rw-r--r--src/ConfigParser.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp
index efcafbd..4aee3ac 100644
--- a/src/ConfigParser.cpp
+++ b/src/ConfigParser.cpp
@@ -297,8 +297,44 @@ static void parse_freq_info(ptree& pt,
} // for over fle
+ size_t required_fi_size = 0; // Without RegionId + length of FI list
+ for (const auto& fle : fi->frequency_information) {
+ size_t list_entry_size = 3; // size of FIG0/21 FI list header
+ switch (fle.rm) {
+ case RangeModulation::dab_ensemble:
+ list_entry_size += fle.fi_dab.frequencies.size() * 3;
+ break;
+ case RangeModulation::fm_with_rds:
+ list_entry_size += fle.fi_fm.frequencies.size() * 1;
+ break;
+ case RangeModulation::amss:
+ list_entry_size += 1; // Id field 2
+ list_entry_size += fle.fi_amss.frequencies.size() * 2;
+ break;
+ case RangeModulation::drm:
+ list_entry_size += 1; // Id field 2
+ list_entry_size += fle.fi_drm.frequencies.size() * 2;
+ break;
+ }
+ required_fi_size += list_entry_size;
+ }
+
+ /* Length of FI list: this 5-bit field, expressed as an unsigned
+ * binary number, shall represent the length in bytes of the field
+ * containing FI list q to FI list g (maximum 26 bytes).
+ *
+ * ETSI EN 300 401 Clause 8.1.8
+ */
+ if (required_fi_size > 26) {
+ throw runtime_error("Too much information carried in FI " +
+ fi_uid + ": " + to_string(required_fi_size) +
+ " bytes needed out of 26 available");
+ }
+
ensemble->frequency_information.push_back(fi);
+
+
} // for over fi
/* We sort all FI to have the OE=0 first and the OE=1 afterwards, to