summaryrefslogtreecommitdiffstats
path: root/src/MuxElements.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2020-03-11 14:58:05 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2020-03-11 14:58:05 +0100
commit5340215304193f18af3bc76c7ae7a6a79f008339 (patch)
tree2f702ce20225c8a345df677b223faf387dac6d1b /src/MuxElements.h
parentccbb69188c53eb693853969327bd081c73f02552 (diff)
downloaddabmux-5340215304193f18af3bc76c7ae7a6a79f008339.tar.gz
dabmux-5340215304193f18af3bc76c7ae7a6a79f008339.tar.bz2
dabmux-5340215304193f18af3bc76c7ae7a6a79f008339.zip
Implement a hash function to calculate FIG 0/7 Count field
This might not be strictly standards compliant, but it avoids having to save state across mux restarts and doesn't place the burden of incrementing the number on the operator.
Diffstat (limited to 'src/MuxElements.h')
-rw-r--r--src/MuxElements.h51
1 files changed, 48 insertions, 3 deletions
diff --git a/src/MuxElements.h b/src/MuxElements.h
index ea7fee5..98de70e 100644
--- a/src/MuxElements.h
+++ b/src/MuxElements.h
@@ -44,6 +44,43 @@
#include "RemoteControl.h"
#include "Eti.h"
+// Protection levels and bitrates for UEP.
+const unsigned char ProtectionLevelTable[64] = {
+ 4, 3, 2, 1, 0,
+ 4, 3, 2, 1, 0,
+ 4, 3, 2, 1,
+ 4, 3, 2, 1, 0,
+ 4, 3, 2, 1, 0,
+ 4, 3, 2, 1, 0,
+ 4, 3, 2, 1,
+ 4, 3, 2, 1, 0,
+ 4, 3, 2, 1, 0,
+ 4, 3, 2, 1, 0,
+ 4, 3, 2, 1, 0,
+ 4, 3, 2, 1, 0,
+ 4, 3, 1,
+ 4, 2, 0
+};
+
+const unsigned short BitRateTable[64] = {
+ 32, 32, 32, 32, 32,
+ 48, 48, 48, 48, 48,
+ 56, 56, 56, 56,
+ 64, 64, 64, 64, 64,
+ 80, 80, 80, 80, 80,
+ 96, 96, 96, 96, 96,
+ 112, 112, 112, 112,
+ 128, 128, 128, 128, 128,
+ 160, 160, 160, 160, 160,
+ 192, 192, 192, 192, 192,
+ 224, 224, 224, 224, 224,
+ 256, 256, 256, 256, 256,
+ 320, 320, 320,
+ 384, 384, 384
+};
+
+
+
class MuxInitException : public std::exception
{
public:
@@ -292,8 +329,13 @@ class dabEnsemble : public RemoteControllable {
// 2 corresponds to program types used in north america
int international_table = 1;
- // Modulo-1024 counter for FIG0/7. Set to -1 to disable FIG0/7
- int reconfig_counter = -1;
+ // Modulo-1024 counter for FIG0/7.
+ // Set to RECONFIG_COUNTER_DISABLED to disable FIG0/7.
+ // Set to RECONFIG_COUNTER_HASH to calculate the counter value using a hash function
+ // on relevant ensemble configuration parameters.
+ static constexpr int RECONFIG_COUNTER_DISABLED = -1;
+ static constexpr int RECONFIG_COUNTER_HASH = -2;
+ int reconfig_counter = RECONFIG_COUNTER_DISABLED;
vec_sp_service services;
vec_sp_component components;
@@ -333,12 +375,15 @@ enum dab_protection_form_t {
};
struct dabProtection {
- unsigned char level;
+ uint8_t level;
dab_protection_form_t form;
union {
dabProtectionUEP uep;
dabProtectionEEP eep;
};
+
+ // According to ETSI EN 300 799 5.4.1.2
+ uint8_t to_tpl() const;
};
class DabSubchannel