summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-03-22 17:17:30 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-03-22 17:17:30 +0100
commit750bcb896be7ab84cc30de58aba4c4620dfcf54b (patch)
treed10ce58e1fe66ea4287c11d7221a570d8f8daf7a /src
parent479b106611539785a92cd77bbf3124c26501fce2 (diff)
downloaddabmux-750bcb896be7ab84cc30de58aba4c4620dfcf54b.tar.gz
dabmux-750bcb896be7ab84cc30de58aba4c4620dfcf54b.tar.bz2
dabmux-750bcb896be7ab84cc30de58aba4c4620dfcf54b.zip
Add local-time-offset and intl. table options
Diffstat (limited to 'src')
-rw-r--r--src/DabMux.cpp6
-rw-r--r--src/MuxElements.h3
-rw-r--r--src/ParserConfigfile.cpp19
-rw-r--r--src/utils.cpp3
4 files changed, 28 insertions, 3 deletions
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index 5fbc035..19d4557 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -1599,7 +1599,7 @@ int main(int argc, char *argv[])
fig0_10->Extension = 10;
index = index + 2;
- timeData = localtime(&date);
+ timeData = gmtime(&date);
fig0_10->RFU = 0;
fig0_10->setMJD(gregorian2mjd(timeData->tm_year + 1900,
@@ -1627,9 +1627,9 @@ int main(int argc, char *argv[])
fig0_9->ext = 0;
fig0_9->lto = 0;
- fig0_9->ensembleLto = 0;
+ fig0_9->ensembleLto = ensemble->lto;
fig0_9->ensembleEcc = ensemble->ecc;
- fig0_9->tableId = 0x2;
+ fig0_9->tableId = ensemble->international_table;
index += 5;
figSize += 5;
diff --git a/src/MuxElements.h b/src/MuxElements.h
index d3227e9..aa4f602 100644
--- a/src/MuxElements.h
+++ b/src/MuxElements.h
@@ -95,6 +95,9 @@ struct dabEnsemble {
uint8_t ecc;
DabLabel label;
uint8_t mode;
+ int lto; // local time offset in half-hours
+ // range: -24 to +24
+ int international_table;
vector<DabService*> services;
vector<DabComponent*> components;
vector<dabSubchannel*> subchannels;
diff --git a/src/ParserConfigfile.cpp b/src/ParserConfigfile.cpp
index 74d9588..4a67186 100644
--- a/src/ParserConfigfile.cpp
+++ b/src/ParserConfigfile.cpp
@@ -189,6 +189,25 @@ void parse_configfile(string configuration_file,
/* Extended Country Code */
ensemble->ecc = hexparse(pt_ensemble.get("ecc", "0"));
+ ensemble->international_table = pt_ensemble.get("international-table", 0);
+
+ double lto_hours = pt_ensemble.get("local-time-offset", 0.0);
+ if (round(lto_hours * 2) != lto_hours * 2) {
+ etiLog.level(error) << "Ensemble local time offset " <<
+ lto_hours << "h cannot be expressed in half-hour blocks.";
+ throw runtime_error("ensemble local-time-offset definition error");
+ }
+ if (lto_hours > 12 || lto_hours < -12) {
+ etiLog.level(error) << "Ensemble local time offset " <<
+ lto_hours << "h out of bounds [-12, +12].";
+ throw runtime_error("ensemble local-time-offset definition error");
+ }
+ ensemble->lto = abs(rint(lto_hours * 2));
+
+ if (lto_hours < 0.0) { // ensemble->lto is 1-bit complement
+ ensemble->lto |= (1<<5); // sign bit
+ }
+
int success = -5;
string ensemble_label = pt_ensemble.get<string>("label");
string ensemble_short_label(ensemble_label);
diff --git a/src/utils.cpp b/src/utils.cpp
index 1cbd9d5..5d67595 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -451,5 +451,8 @@ void printEnsemble(dabEnsemble* ensemble)
etiLog.log(info, " (0x%x)", ensemble->label.flag());
etiLog.log(info, " mode: %u", ensemble->mode);
+ etiLog.log(info, " lto: %f", 2.0 * ensemble->lto);
+ etiLog.log(info, " intl. table. %d", ensemble->international_table);
+
}