summaryrefslogtreecommitdiffstats
path: root/src/fig/FIG1.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-08-07 15:06:25 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-08-07 15:06:25 +0200
commit02a16fd582e5aa82ddb070c02bf3d7a269685e27 (patch)
treeb6f061b494af3b0165a4f32cfd4bd79cb56f6d69 /src/fig/FIG1.cpp
parent2773aecdea641ca8a0b362085eba3dc5273e0fa6 (diff)
downloaddabmux-02a16fd582e5aa82ddb070c02bf3d7a269685e27.tar.gz
dabmux-02a16fd582e5aa82ddb070c02bf3d7a269685e27.tar.bz2
dabmux-02a16fd582e5aa82ddb070c02bf3d7a269685e27.zip
Add FIG1/1
Diffstat (limited to 'src/fig/FIG1.cpp')
-rw-r--r--src/fig/FIG1.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/fig/FIG1.cpp b/src/fig/FIG1.cpp
index e596408..98932b3 100644
--- a/src/fig/FIG1.cpp
+++ b/src/fig/FIG1.cpp
@@ -67,5 +67,50 @@ FillStatus FIG1_0::fill(uint8_t *buf, size_t max_size)
return fs;
}
+FillStatus FIG1_1::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 < 4) {
+ break;
+ }
+
+ if ((*service)->getType(ensemble) == subchannel_type_t::Audio) {
+ auto fig1_1 = (FIGtype1_1 *)buf;
+
+ fig1_1->FIGtypeNumber = 1;
+ fig1_1->Length = 21;
+ fig1_1->Charset = 0;
+ fig1_1->OE = 0;
+ fig1_1->Extension = 1;
+
+ fig1_1->Sld = htons((*service)->id);
+ buf += 4;
+ remaining -= 4;
+ }
+ }
+
+ fs.num_bytes_written = max_size - remaining;
+ return fs;
+}
+
} // namespace FIC