summaryrefslogtreecommitdiffstats
path: root/src/fig/FIG1.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-08-07 15:21:32 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-08-07 15:21:32 +0200
commit6ec023f52071f6081441926616d225bced26a254 (patch)
tree8df09036a3b7154fe1dc60bb84cc89b07100317a /src/fig/FIG1.cpp
parent8da80a379f0e76defba27b6b489137b77acd0ead (diff)
downloaddabmux-6ec023f52071f6081441926616d225bced26a254.tar.gz
dabmux-6ec023f52071f6081441926616d225bced26a254.tar.bz2
dabmux-6ec023f52071f6081441926616d225bced26a254.zip
Add FIG1/5
Diffstat (limited to 'src/fig/FIG1.cpp')
-rw-r--r--src/fig/FIG1.cpp68
1 files changed, 67 insertions, 1 deletions
diff --git a/src/fig/FIG1.cpp b/src/fig/FIG1.cpp
index 98932b3..fa8e380 100644
--- a/src/fig/FIG1.cpp
+++ b/src/fig/FIG1.cpp
@@ -67,6 +67,8 @@ FillStatus FIG1_0::fill(uint8_t *buf, size_t max_size)
return fs;
}
+//=========== FIG 1/1 ===========
+
FillStatus FIG1_1::fill(uint8_t *buf, size_t max_size)
{
FillStatus fs;
@@ -89,7 +91,7 @@ FillStatus FIG1_1::fill(uint8_t *buf, size_t max_size)
for (; service != ensemble->services.end();
++service) {
- if (remaining < 4) {
+ if (remaining < 4 + 16 + 2) {
break;
}
@@ -105,6 +107,70 @@ FillStatus FIG1_1::fill(uint8_t *buf, size_t max_size)
fig1_1->Sld = htons((*service)->id);
buf += 4;
remaining -= 4;
+
+ (*service)->label.writeLabel(buf);
+ buf += 16;
+ remaining -= 16;
+
+ buf[0] = (*service)->label.flag() >> 8;
+ buf[1] = (*service)->label.flag() & 0xFF;
+ buf += 2;
+ remaining -= 2;
+ }
+ }
+
+ fs.num_bytes_written = max_size - remaining;
+ return fs;
+}
+
+//=========== FIG 1/5 ===========
+
+FillStatus FIG1_5::fill(uint8_t *buf, size_t max_size)
+{
+ FillStatus fs;
+
+ ssize_t remaining = max_size;
+
+ if (not m_initialised) {
+ service = m_rti->ensemble->services.end();
+ }
+
+ auto ensemble = m_rti->ensemble;
+
+ // Rotate through the subchannels until there is no more
+ // space
+ if (service == ensemble->services.end()) {
+ service = ensemble->services.begin();
+ fs.complete_fig_transmitted = true;
+ }
+
+ for (; service != ensemble->services.end();
+ ++service) {
+
+ if (remaining < 6 + 16 + 2) {
+ break;
+ }
+
+ if ((*service)->getType(ensemble) != subchannel_type_t::Audio) {
+ auto fig1_5 = (FIGtype1_5 *)buf;
+ fig1_5->FIGtypeNumber = 1;
+ fig1_5->Length = 23;
+ fig1_5->Charset = 0;
+ fig1_5->OE = 0;
+ fig1_5->Extension = 5;
+
+ fig1_5->SId = htonl((*service)->id);
+ buf += 6;
+ remaining -= 6;
+
+ (*service)->label.writeLabel(buf);
+ buf += 16;
+ remaining -= 16;
+
+ buf[0] = (*service)->label.flag() >> 8;
+ buf[1] = (*service)->label.flag() & 0xFF;
+ buf += 2;
+ remaining -= 2;
}
}