summaryrefslogtreecommitdiffstats
path: root/src/fig
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
parent8da80a379f0e76defba27b6b489137b77acd0ead (diff)
downloaddabmux-6ec023f52071f6081441926616d225bced26a254.tar.gz
dabmux-6ec023f52071f6081441926616d225bced26a254.tar.bz2
dabmux-6ec023f52071f6081441926616d225bced26a254.zip
Add FIG1/5
Diffstat (limited to 'src/fig')
-rw-r--r--src/fig/FIG1.cpp68
-rw-r--r--src/fig/FIG1.h20
-rw-r--r--src/fig/FIGCarousel.cpp4
-rw-r--r--src/fig/FIGCarousel.h1
4 files changed, 90 insertions, 3 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;
}
}
diff --git a/src/fig/FIG1.h b/src/fig/FIG1.h
index 926418f..c24877a 100644
--- a/src/fig/FIG1.h
+++ b/src/fig/FIG1.h
@@ -49,7 +49,7 @@ class FIG1_0 : public IFIG
FIGRuntimeInformation *m_rti;
};
-// FIG type 1/1
+// FIG type 1/1, programme service label
class FIG1_1 : public IFIG
{
public:
@@ -67,6 +67,24 @@ class FIG1_1 : public IFIG
std::vector<std::shared_ptr<DabService> >::iterator service;
};
+// FIG type 1/5, data service label
+class FIG1_5 : public IFIG
+{
+ public:
+ FIG1_5(FIGRuntimeInformation* rti) :
+ m_rti(rti), m_initialised(false) {}
+ virtual FillStatus fill(uint8_t *buf, size_t max_size);
+ virtual FIG_rate repetition_rate(void) { return FIG_rate::B; }
+
+ virtual const int figtype(void) const { return 1; }
+ virtual const int figextension(void) const { return 0; }
+
+ private:
+ FIGRuntimeInformation *m_rti;
+ bool m_initialised;
+ std::vector<std::shared_ptr<DabService> >::iterator service;
+};
+
}
#endif // __FIG1_H_
diff --git a/src/fig/FIGCarousel.cpp b/src/fig/FIGCarousel.cpp
index 6dfc1aa..932945a 100644
--- a/src/fig/FIGCarousel.cpp
+++ b/src/fig/FIGCarousel.cpp
@@ -65,7 +65,8 @@ FIGCarousel::FIGCarousel(boost::shared_ptr<dabEnsemble> ensemble) :
m_fig0_13(&m_rti),
m_fig0_10(&m_rti),
m_fig0_9(&m_rti),
- m_fig1_1(&m_rti)
+ m_fig1_1(&m_rti),
+ m_fig1_5(&m_rti)
{
load_and_allocate(m_fig0_0, 0);
load_and_allocate(m_fig0_1, 0);
@@ -80,6 +81,7 @@ FIGCarousel::FIGCarousel(boost::shared_ptr<dabEnsemble> ensemble) :
load_and_allocate(m_fig0_9, 1);
load_and_allocate(m_fig1_1, 2);
+ load_and_allocate(m_fig1_5, 2);
}
void FIGCarousel::load_and_allocate(IFIG& fig, int fib)
diff --git a/src/fig/FIGCarousel.h b/src/fig/FIGCarousel.h
index 295c2cb..0e70f40 100644
--- a/src/fig/FIGCarousel.h
+++ b/src/fig/FIGCarousel.h
@@ -83,6 +83,7 @@ class FIGCarousel {
// FIB 2 figs
FIG1_1 m_fig1_1;
+ FIG1_5 m_fig1_5;
};
} // namespace FIC