summaryrefslogtreecommitdiffstats
path: root/src/fig/FIG0.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-07-18 22:57:00 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-07-18 22:57:00 +0200
commit28c3aa4a6935d870b15087992536341d390f969c (patch)
tree6d873aadfc60827bdaf5f5f6613c87ea650aec80 /src/fig/FIG0.cpp
parent0d8780510f504fc3606d703aebd4e5322d55c326 (diff)
downloaddabmux-28c3aa4a6935d870b15087992536341d390f969c.tar.gz
dabmux-28c3aa4a6935d870b15087992536341d390f969c.tar.bz2
dabmux-28c3aa4a6935d870b15087992536341d390f969c.zip
Add FIG0/17 to FIB0
Diffstat (limited to 'src/fig/FIG0.cpp')
-rw-r--r--src/fig/FIG0.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/fig/FIG0.cpp b/src/fig/FIG0.cpp
index a255445..612aa20 100644
--- a/src/fig/FIG0.cpp
+++ b/src/fig/FIG0.cpp
@@ -384,3 +384,78 @@ size_t FIG0_3::fill(uint8_t *buf, size_t max_size)
return max_size - remaining;
}
+//=========== FIG 0/17 ===========
+
+FIG0_17::FIG0_17(FIGRuntimeInformation *rti) :
+ m_rti(rti)
+{
+ serviceFIG0_17 = m_rti->ensemble->services.end();
+}
+
+size_t FIG0_17::fill(uint8_t *buf, size_t max_size)
+{
+ ssize_t remaining = max_size;
+ auto ensemble = m_rti->ensemble;
+
+ FIGtype0* fig0 = NULL;
+
+ if (serviceFIG0_17 == ensemble->services.end()) {
+ serviceFIG0_17 = ensemble->services.begin();
+ }
+ for (; serviceFIG0_17 != ensemble->services.end();
+ ++serviceFIG0_17) {
+
+ if ( (*serviceFIG0_17)->pty == 0 &&
+ (*serviceFIG0_17)->language == 0) {
+ continue;
+ }
+
+ if (fig0 == NULL) {
+ fig0 = (FIGtype0*)buf;
+ fig0->FIGtypeNumber = 0;
+ fig0->Length = 1;
+ fig0->CN = 0;
+ fig0->OE = 0;
+ fig0->PD = 0;
+ fig0->Extension = 17;
+ buf += 2;
+ remaining -= 2;
+ }
+
+ if ((*serviceFIG0_17)->language == 0) {
+ if (remaining < 4) {
+ break;
+ }
+ }
+ else {
+ if (remaining < 5) {
+ break;
+ }
+ }
+
+ auto programme = (FIGtype0_17_programme*)buf;
+ programme->SId = htons((*serviceFIG0_17)->id);
+ programme->SD = 1;
+ programme->PS = 0;
+ programme->L = (*serviceFIG0_17)->language != 0;
+ programme->CC = 0;
+ programme->Rfa = 0;
+ programme->NFC = 0;
+ if ((*serviceFIG0_17)->language == 0) {
+ buf[3] = (*serviceFIG0_17)->pty;
+ fig0->Length += 4;
+ buf += 4;
+ remaining -= 4;
+ }
+ else {
+ buf[3] = (*serviceFIG0_17)->language;
+ buf[4] = (*serviceFIG0_17)->pty;
+ fig0->Length += 5;
+ buf += 5;
+ remaining -= 5;
+ }
+ }
+
+ return max_size - remaining;
+}
+