aboutsummaryrefslogtreecommitdiffstats
path: root/src/DabMux.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-12-23 22:27:03 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-12-23 22:27:03 +0100
commit2b014e2f00df81eefe977b901ab601ea11ccb895 (patch)
treea5c6fe371838ff3e153c99c6a87554b55b2284d1 /src/DabMux.cpp
parent1d2c8bf95e8d9c7c6f282f266b149bc82f1c8371 (diff)
downloaddabmux-2b014e2f00df81eefe977b901ab601ea11ccb895.tar.gz
dabmux-2b014e2f00df81eefe977b901ab601ea11ccb895.tar.bz2
dabmux-2b014e2f00df81eefe977b901ab601ea11ccb895.zip
Add EDI fragment interleaver
Diffstat (limited to 'src/DabMux.cpp')
-rw-r--r--src/DabMux.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index 04d1980..450179d 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -98,10 +98,6 @@ typedef DWORD32 uint32_t;
#include "input/Zmq.h"
#include "dabOutput/dabOutput.h"
-#include "dabOutput/edi/TagItems.h"
-#include "dabOutput/edi/TagPacket.h"
-#include "dabOutput/edi/AFPacket.h"
-#include "dabOutput/edi/PFT.h"
#include "crc.h"
#include "UdpSocket.h"
#include "InetAddress.h"
@@ -311,6 +307,20 @@ int main(int argc, char *argv[])
edi_conf.fec = pt_edi.get<unsigned int>("fec", 3);
edi_conf.chunk_len = pt_edi.get<unsigned int>("chunk_len", 207);
+ double interleave_ms = pt_edi.get<double>("interleave", 0);
+ if (interleave_ms != 0.0) {
+ if (interleave_ms < 0) {
+ throw runtime_error("EDI output: negative interleave value is invalid.");
+ }
+
+ auto latency_rounded = lround(interleave_ms / 24.0);
+ if (latency_rounded * 24 > 30000) {
+ throw runtime_error("EDI output: interleaving set for more than 30 seconds!");
+ }
+
+ edi_conf.latency_frames = latency_rounded;
+ }
+
edi_conf.tagpacket_alignment = pt_edi.get<unsigned int>("tagpacket_alignment", 8);
mux.set_edi_config(edi_conf);
@@ -417,6 +427,9 @@ int main(int argc, char *argv[])
}
etiLog.level(info) << " source port " << edi_dest.source_port;
}
+ if (edi_conf.interleaver_enabled()) {
+ etiLog.level(info) << " interleave " << edi_conf.latency_frames * 24 << " ms";
+ }
}
#endif