summaryrefslogtreecommitdiffstats
path: root/src/fig/FIG1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fig/FIG1.cpp')
-rw-r--r--src/fig/FIG1.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/fig/FIG1.cpp b/src/fig/FIG1.cpp
index dd1e70b..d0b6a17 100644
--- a/src/fig/FIG1.cpp
+++ b/src/fig/FIG1.cpp
@@ -3,7 +3,7 @@
2011, 2012 Her Majesty the Queen in Right of Canada (Communications
Research Center Canada)
- Copyright (C) 2015
+ Copyright (C) 2019
Matthias P. Braendli, matthias.braendli@mpb.li
Implementation of FIG1
@@ -37,6 +37,12 @@ FillStatus FIG1_0::fill(uint8_t *buf, size_t max_size)
auto ensemble = m_rti->ensemble;
size_t remaining = max_size;
+ if (not ensemble->label.has_fig1_label()) {
+ fs.complete_fig_transmitted = true;
+ fs.num_bytes_written = 0;
+ return fs;
+ }
+
if (remaining < 22) {
fs.num_bytes_written = 0;
return fs;
@@ -83,14 +89,15 @@ FillStatus FIG1_1::fill(uint8_t *buf, size_t max_size)
// Rotate through the subchannels until there is no more
// space
- for (; service != ensemble->services.end();
- ++service) {
-
+ for (; service != ensemble->services.end(); ++service) {
if (remaining < 4 + 16 + 2) {
break;
}
- if ((*service)->getType(ensemble) == subchannel_type_t::DABPlusAudio || (*service)->getType(ensemble) == subchannel_type_t::DABAudio) {
+ const auto type = (*service)->getType(ensemble);
+
+ if ( (type == subchannel_type_t::DABPlusAudio or type == subchannel_type_t::DABAudio) and
+ (*service)->label.has_fig1_label()) {
auto fig1_1 = (FIGtype1_1 *)buf;
fig1_1->FIGtypeNumber = 1;
@@ -148,8 +155,10 @@ FillStatus FIG1_4::fill(uint8_t *buf, size_t max_size)
/* We check in the config parser if the primary component has
* a label, which is forbidden since V2.1.1 */
+ const auto type = (*service)->getType(ensemble);
+
if (not (*component)->label.long_label().empty() ) {
- if ((*service)->getType(ensemble) == subchannel_type_t::DABPlusAudio || (*service)->getType(ensemble) == subchannel_type_t::DABAudio) {
+ if (type == subchannel_type_t::DABAudio or type == subchannel_type_t::DABPlusAudio) {
if (remaining < 5 + 16 + 2) {
break;
@@ -173,7 +182,6 @@ FillStatus FIG1_4::fill(uint8_t *buf, size_t max_size)
remaining -= 5;
}
else { // Data
-
if (remaining < 7 + 16 + 2) {
break;
}
@@ -237,7 +245,10 @@ FillStatus FIG1_5::fill(uint8_t *buf, size_t max_size)
break;
}
- if ((*service)->getType(ensemble) == subchannel_type_t::DABPlusAudio || (*service)->getType(ensemble) == subchannel_type_t::DABAudio) {
+ const auto type = (*service)->getType(ensemble);
+ const bool is_audio = (type == subchannel_type_t::DABAudio or type == subchannel_type_t::DABPlusAudio);
+
+ if (not is_audio) {
auto fig1_5 = (FIGtype1_5 *)buf;
fig1_5->FIGtypeNumber = 1;
fig1_5->Length = 23;