aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/fig/FIG1.cpp45
-rw-r--r--src/fig/FIG1.h18
-rw-r--r--src/fig/FIGCarousel.cpp5
-rw-r--r--src/fig/FIGCarousel.h5
4 files changed, 70 insertions, 3 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
diff --git a/src/fig/FIG1.h b/src/fig/FIG1.h
index e853152..926418f 100644
--- a/src/fig/FIG1.h
+++ b/src/fig/FIG1.h
@@ -49,9 +49,25 @@ class FIG1_0 : public IFIG
FIGRuntimeInformation *m_rti;
};
-}
+// FIG type 1/1
+class FIG1_1 : public IFIG
+{
+ public:
+ FIG1_1(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 871470f..6dfc1aa 100644
--- a/src/fig/FIGCarousel.cpp
+++ b/src/fig/FIGCarousel.cpp
@@ -64,7 +64,8 @@ FIGCarousel::FIGCarousel(boost::shared_ptr<dabEnsemble> ensemble) :
m_fig1_0(&m_rti),
m_fig0_13(&m_rti),
m_fig0_10(&m_rti),
- m_fig0_9(&m_rti)
+ m_fig0_9(&m_rti),
+ m_fig1_1(&m_rti)
{
load_and_allocate(m_fig0_0, 0);
load_and_allocate(m_fig0_1, 0);
@@ -77,6 +78,8 @@ FIGCarousel::FIGCarousel(boost::shared_ptr<dabEnsemble> ensemble) :
load_and_allocate(m_fig0_13, 1);
load_and_allocate(m_fig0_10, 1);
load_and_allocate(m_fig0_9, 1);
+
+ load_and_allocate(m_fig1_1, 2);
}
void FIGCarousel::load_and_allocate(IFIG& fig, int fib)
diff --git a/src/fig/FIGCarousel.h b/src/fig/FIGCarousel.h
index d43e33e..295c2cb 100644
--- a/src/fig/FIGCarousel.h
+++ b/src/fig/FIGCarousel.h
@@ -74,12 +74,15 @@ class FIGCarousel {
FIG0_3 m_fig0_3;
FIG0_17 m_fig0_17;
- // FIG 1 figs
+ // FIB 1 figs
FIG0_8 m_fig0_8;
FIG1_0 m_fig1_0;
FIG0_13 m_fig0_13;
FIG0_10 m_fig0_10;
FIG0_9 m_fig0_9;
+
+ // FIB 2 figs
+ FIG1_1 m_fig1_1;
};
} // namespace FIC