summaryrefslogtreecommitdiffstats
path: root/src/DabMultiplexer.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-01-10 16:13:31 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-01-10 20:32:49 +0100
commit641a1ffdf4e6d0bddfec27b474356254214d0cb7 (patch)
treeb4baee3901dcc84d8251124c013c1a9a154bb6d3 /src/DabMultiplexer.cpp
parent70c5ba0867945bb097f466262ce03470b690518f (diff)
downloaddabmux-641a1ffdf4e6d0bddfec27b474356254214d0cb7.tar.gz
dabmux-641a1ffdf4e6d0bddfec27b474356254214d0cb7.tar.bz2
dabmux-641a1ffdf4e6d0bddfec27b474356254214d0cb7.zip
Set edi TIST, still in an incorrect way
Diffstat (limited to 'src/DabMultiplexer.cpp')
-rw-r--r--src/DabMultiplexer.cpp44
1 files changed, 26 insertions, 18 deletions
diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp
index d9e1a10..28f799d 100644
--- a/src/DabMultiplexer.cpp
+++ b/src/DabMultiplexer.cpp
@@ -239,6 +239,10 @@ void DabMultiplexer::prepare()
*/
gettimeofday(&mnsc_time, NULL);
+ if (clock_gettime(CLOCK_REALTIME, &edi_time)) {
+ throw std::runtime_error("Setting eti_time with clock_gettime failed");
+ }
+
#if HAVE_OUTPUT_EDI
// Try to load offset once
@@ -471,22 +475,6 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
// The above Tag Items will be assembled into a TAG Packet
TagPacket edi_tagpacket(edi_conf.tagpacket_alignment);
- edi_tagDETI.atstf = 1;
- edi_tagDETI.utco = 0;
- edi_tagDETI.seconds = 0;
- try {
- bool tist_enabled = m_pt.get("general.tist", false);
-
- if (tist_enabled and edi_conf.enabled) {
- edi_tagDETI.set_utco(m_clock_tai.get_offset());
- }
-
- edi_tagDETI.set_seconds(mnsc_time);
- }
- catch (std::runtime_error& e) {
- etiLog.level(error) << "Could not get UTC-TAI offset for EDI timestamp";
- }
-
date = getDabTime();
// Initialise the ETI frame
@@ -1784,12 +1772,29 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
bool enableTist = m_pt.get("general.tist", false);
if (enableTist) {
tist->TIST = htonl(timestamp) | 0xff;
+ edi_tagDETI.tsta = timestamp & 0xffffff;
}
else {
tist->TIST = htonl(0xffffff) | 0xff;
+ edi_tagDETI.tsta = 0xffffff;
+ }
+
+ edi_tagDETI.atstf = 1;
+ edi_tagDETI.utco = 0;
+ edi_tagDETI.seconds = 0;
+ try {
+ bool tist_enabled = m_pt.get("general.tist", false);
+
+ if (tist_enabled and edi_conf.enabled) {
+ edi_tagDETI.set_utco(m_clock_tai.get_offset());
+ edi_tagDETI.set_seconds(edi_time);
+ }
+
+ }
+ catch (std::runtime_error& e) {
+ etiLog.level(error) << "Could not get UTC-TAI offset for EDI timestamp";
}
- edi_tagDETI.tsta = tist->TIST;
/* Coding of the TIST, according to ETS 300 799 Annex C
@@ -1808,8 +1813,11 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
{
timestamp -= 0xfa0000; // Substract 16384000, corresponding to one second
- // Also update MNSC time for next frame
+ // Also update MNSC time for next time FP==0
MNSC_increment_time = true;
+
+ // Immediately update edi time
+ edi_time.tv_sec++;
}