From a1921a1a967b65c99a830141e9faaecd77b0f317 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 28 Jul 2017 11:54:32 +0200 Subject: Add new zeromq config format This gives the choice for the transmission of the metadata, and the enabling of the TAI downloader is also triggered appropriately --- src/DabMultiplexer.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/DabMultiplexer.cpp') diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp index 58a1c8f..c109919 100644 --- a/src/DabMultiplexer.cpp +++ b/src/DabMultiplexer.cpp @@ -3,7 +3,7 @@ 2011, 2012 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2016 + Copyright (C) 2017 Matthias P. Braendli, matthias.braendli@mpb.li */ /* @@ -75,6 +75,7 @@ DabMultiplexer::DabMultiplexer( sync(0x49C5F8), currentFrame(0), ensemble(std::make_shared()), + m_tai_clock_required(false), m_clock_tai(), fig_carousel(ensemble) { @@ -128,7 +129,7 @@ void DabMultiplexer::set_edi_config(const edi_configuration_t& new_edi_conf) // Run a set of checks on the configuration -void DabMultiplexer::prepare() +void DabMultiplexer::prepare(bool require_tai_clock) { parse_ptree(m_pt, ensemble); @@ -168,17 +169,16 @@ void DabMultiplexer::prepare() bool tist_enabled = m_pt.get("general.tist", false); - if (tist_enabled and edi_conf.enabled()) { + m_tai_clock_required = (tist_enabled and edi_conf.enabled()) or require_tai_clock; + + if (m_tai_clock_required) { try { m_clock_tai.get_offset(); } catch (std::runtime_error& e) { - const char* err_msg = - "Could not initialise TAI clock properly required by " - "EDI with timestamp. Do you have a working internet " - "connection?"; - - etiLog.level(error) << err_msg; + etiLog.level(error) << + "Could not initialise TAI clock properly. " + "Do you have a working internet connection?"; throw; } } @@ -654,16 +654,16 @@ void DabMultiplexer::mux_frame(std::vector >& outputs try { bool tist_enabled = m_pt.get("general.tist", false); - if (tist_enabled and edi_conf.enabled()) { + if (tist_enabled and m_tai_clock_required) { edi_tagDETI.set_seconds(edi_time); // In case get_offset fails, we still want to update the EDI seconds - const auto utco = m_clock_tai.get_offset(); - edi_tagDETI.set_tai_utc_offset(utco); + const auto tai_utc_offset = m_clock_tai.get_offset(); + edi_tagDETI.set_tai_utc_offset(tai_utc_offset); for (auto output : outputs) { shared_ptr md_utco = - make_shared(utco); + make_shared(edi_tagDETI.utco); output->setMetadata(md_utco); shared_ptr md_edi_time = -- cgit v1.2.3