summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-01-10 11:26:44 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-01-10 11:28:42 +0100
commitc823c87d6f286310e9efd9e723f2e14c3320d31f (patch)
treed31cb64ebad1ecd49ca970064aed729288b2e905
parenta8cc30be9589280d9bde3ddaf676610c9b12af2a (diff)
downloaddabmux-c823c87d6f286310e9efd9e723f2e14c3320d31f.tar.gz
dabmux-c823c87d6f286310e9efd9e723f2e14c3320d31f.tar.bz2
dabmux-c823c87d6f286310e9efd9e723f2e14c3320d31f.zip
Add EDI timestamp offset configuration
-rw-r--r--doc/advanced.mux5
-rw-r--r--src/DabMultiplexer.cpp16
-rw-r--r--src/DabMultiplexer.h1
3 files changed, 18 insertions, 4 deletions
diff --git a/doc/advanced.mux b/doc/advanced.mux
index 974df78..ab145fa 100644
--- a/doc/advanced.mux
+++ b/doc/advanced.mux
@@ -31,6 +31,11 @@ general {
; This also enables time encoding using the MNSC.
tist false
+ ; On startup, EDI time is initialised to system time. If you want
+ ; to add an offset, uncomment the following line and give a number
+ ; in seconds.
+ ; tist_edioffset 0
+
; The management server is a simple TCP server that can present
; statistics data (buffers, overruns, underruns, etc)
; which can then be graphed a tool like Munin
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<int>("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<std::shared_ptr<DabOutput> >& 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<dabEnsemble> ensemble;
+ int m_tist_edioffset = 0;
bool m_tai_clock_required;
ClockTAI m_clock_tai;