From c823c87d6f286310e9efd9e723f2e14c3320d31f Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Thu, 10 Jan 2019 11:26:44 +0100 Subject: Add EDI timestamp offset configuration --- src/DabMultiplexer.cpp | 16 ++++++++++++---- src/DabMultiplexer.h | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp index 719e767..95a0cce 100644 --- a/src/DabMultiplexer.cpp +++ b/src/DabMultiplexer.cpp @@ -92,8 +92,8 @@ DabMultiplexer::DabMultiplexer( m_clock_tai(split_pipe_separated_string(pt.get("general.tai_clock_bulletins", ""))), fig_carousel(ensemble) { - RC_ADD_PARAMETER(frames, - "Show number of frames generated [read-only]"); + RC_ADD_PARAMETER(frames, "Show number of frames generated [read-only]"); + RC_ADD_PARAMETER(tist_edioffset, "EDI Time offset in seconds"); rcs.enrol(&m_clock_tai); } @@ -191,6 +191,7 @@ void DabMultiplexer::prepare(bool require_tai_clock) // Try to load offset once bool tist_enabled = m_pt.get("general.tist", false); + m_tist_edioffset = m_pt.get("general.tist_edioffset", 0); m_tai_clock_required = (tist_enabled and edi_conf.enabled()) or require_tai_clock; @@ -666,10 +667,11 @@ void DabMultiplexer::mux_frame(std::vector >& outputs edi_tagDETI.seconds = 0; #if HAVE_OUTPUT_EDI try { - bool tist_enabled = m_pt.get("general.tist", false); + const bool tist_enabled = m_pt.get("general.tist", false); if (tist_enabled and m_tai_clock_required) { - edi_tagDETI.set_seconds(edi_time); + edi_tagDETI.set_seconds(edi_time + + std::chrono::seconds(m_tist_edioffset)); // In case get_offset fails, we still want to update the EDI seconds const auto tai_utc_offset = m_clock_tai.get_offset(); @@ -863,6 +865,9 @@ void DabMultiplexer::set_parameter(const std::string& parameter, " is read-only"; throw ParameterError(ss.str()); } + else if (parameter == "tist_edioffset") { + m_tist_edioffset = std::stoi(value); + } else { stringstream ss; ss << "Parameter '" << parameter << @@ -878,6 +883,9 @@ const std::string DabMultiplexer::get_parameter(const std::string& parameter) co if (parameter == "frames") { ss << currentFrame; } + else if (parameter == "tist_edioffset") { + ss << m_tist_edioffset; + } else { ss << "Parameter '" << parameter << "' is not exported by controllable " << get_rc_name(); diff --git a/src/DabMultiplexer.h b/src/DabMultiplexer.h index 499e023..127ecfb 100644 --- a/src/DabMultiplexer.h +++ b/src/DabMultiplexer.h @@ -95,6 +95,7 @@ class DabMultiplexer : public RemoteControllable { std::shared_ptr ensemble; + int m_tist_edioffset = 0; bool m_tai_clock_required; ClockTAI m_clock_tai; -- cgit v1.2.3