summaryrefslogtreecommitdiffstats
path: root/src/input/Edi.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-12-10 15:47:32 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-12-10 15:47:32 +0100
commit66c2acf2606877d00e056c1d1228b32d0a15c5bc (patch)
treeb520bf648e8c511d772266e26bccf527859dbd1a /src/input/Edi.cpp
parente845a4188b93a31445a780ae11f33286420cb038 (diff)
downloaddabmux-66c2acf2606877d00e056c1d1228b32d0a15c5bc.tar.gz
dabmux-66c2acf2606877d00e056c1d1228b32d0a15c5bc.tar.bz2
dabmux-66c2acf2606877d00e056c1d1228b32d0a15c5bc.zip
Make EDI input TIST delay configurable
Diffstat (limited to 'src/input/Edi.cpp')
-rw-r--r--src/input/Edi.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/input/Edi.cpp b/src/input/Edi.cpp
index f4b5e25..b5301d2 100644
--- a/src/input/Edi.cpp
+++ b/src/input/Edi.cpp
@@ -62,6 +62,8 @@ Edi::Edi(const std::string& name, const dab_input_edi_config_t& config) :
RC_ADD_PARAMETER(prebuffering,
"Min buffer level before streaming starts [24ms frames]");
+
+ RC_ADD_PARAMETER(tistdelay, "TIST delay to add [ms]");
}
Edi::~Edi() {
@@ -209,7 +211,8 @@ size_t Edi::readFrame(uint8_t *buffer, size_t size, std::time_t seconds, int utc
// difference between the input frame timestamp and the requested
// timestamp.
if (m_pending_sti_frame.timestamp.valid()) {
- const auto ts_req = EdiDecoder::frame_timestamp_t::from_unix_epoch(seconds, utco, tsta);
+ auto ts_req = EdiDecoder::frame_timestamp_t::from_unix_epoch(seconds, utco, tsta);
+ ts_req += m_tist_delay;
const double offset = m_pending_sti_frame.timestamp.diff_ms(ts_req);
if (offset < 24e-3) {
@@ -274,7 +277,8 @@ size_t Edi::readFrame(uint8_t *buffer, size_t size, std::time_t seconds, int utc
return 0;
}
else {
- const auto ts_req = EdiDecoder::frame_timestamp_t::from_unix_epoch(seconds, utco, tsta);
+ auto ts_req = EdiDecoder::frame_timestamp_t::from_unix_epoch(seconds, utco, tsta);
+ ts_req += m_tist_delay;
const double offset = m_pending_sti_frame.timestamp.diff_ms(ts_req);
if (offset > 24e-3) {
@@ -384,6 +388,9 @@ void Edi::set_parameter(const std::string& parameter, const std::string& value)
throw ParameterError("Invalid value for '" + parameter + "' in controllable " + get_rc_name());
}
}
+ else if (parameter == "tistdelay") {
+ m_tist_delay = chrono::milliseconds(stoi(value));
+ }
else {
throw ParameterError("Parameter '" + parameter + "' is not exported by controllable " + get_rc_name());
}
@@ -408,6 +415,9 @@ const std::string Edi::get_parameter(const std::string& parameter) const
break;
}
}
+ else if (parameter == "tistdelay") {
+ ss << m_tist_delay.count();
+ }
else {
throw ParameterError("Parameter '" + parameter + "' is not exported by controllable " + get_rc_name());
}