summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/MuxElements.cpp21
-rw-r--r--src/fig/FIG0_13.cpp5
-rw-r--r--src/fig/FIG0_2.cpp2
-rw-r--r--src/fig/FIG1.cpp9
-rw-r--r--src/fig/FIG2.cpp6
5 files changed, 15 insertions, 28 deletions
diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp
index 809f09f..b7536b6 100644
--- a/src/MuxElements.cpp
+++ b/src/MuxElements.cpp
@@ -509,26 +509,17 @@ subchannel_type_t DabService::getType(
bool DabService::isProgramme(const std::shared_ptr<dabEnsemble>& ensemble) const
{
- bool ret = false;
switch (getType(ensemble)) {
- case subchannel_type_t::DABAudio: // DAB
- ret = true;
- break;
- case subchannel_type_t::DABPlusAudio: // DABPlus
- ret = true;
- break;
+ case subchannel_type_t::DABAudio:
+ case subchannel_type_t::DABPlusAudio:
+ return true;
case subchannel_type_t::DataDmb:
case subchannel_type_t::Packet:
- ret = false;
- break;
+ return false;
default:
- etiLog.log(error,
- "Error, unknown service type: %u",
- getType(ensemble));
- throw runtime_error("DabService::isProgramme unknown service type");
+ etiLog.log(error, "Error, unknown service type: %u", getType(ensemble));
+ throw logic_error("DabService::isProgramme unknown service type");
}
-
- return ret;
}
diff --git a/src/fig/FIG0_13.cpp b/src/fig/FIG0_13.cpp
index 433838e..314c6e1 100644
--- a/src/fig/FIG0_13.cpp
+++ b/src/fig/FIG0_13.cpp
@@ -89,8 +89,9 @@ FillStatus FIG0_13::fill(uint8_t *buf, size_t max_size)
continue;
}
- if ( m_transmit_programme &&
- ((*subchannel)->type == subchannel_type_t::DABPlusAudio || (*subchannel)->type == subchannel_type_t::DABAudio) &&
+ const auto type = (*subchannel)->type;
+ if ( m_transmit_programme and
+ (type == subchannel_type_t::DABPlusAudio or type == subchannel_type_t::DABAudio) and
(*componentFIG0_13)->audio.uaType != 0xffff) {
const int required_size = 3+4+11;
diff --git a/src/fig/FIG0_2.cpp b/src/fig/FIG0_2.cpp
index 0b6cd87..c9f8371 100644
--- a/src/fig/FIG0_2.cpp
+++ b/src/fig/FIG0_2.cpp
@@ -193,7 +193,7 @@ FillStatus FIG0_2::fill(uint8_t *buf, size_t max_size)
break;
}
- if (type == subchannel_type_t::DABPlusAudio || type == subchannel_type_t::DABAudio) {
+ if (type == subchannel_type_t::DABPlusAudio or type == subchannel_type_t::DABAudio) {
auto fig0_2serviceAudio = (FIGtype0_2_Service*)buf;
fig0_2serviceAudio->SId = htons((*serviceFIG0_2)->id);
diff --git a/src/fig/FIG1.cpp b/src/fig/FIG1.cpp
index d0b6a17..6683f17 100644
--- a/src/fig/FIG1.cpp
+++ b/src/fig/FIG1.cpp
@@ -94,10 +94,9 @@ FillStatus FIG1_1::fill(uint8_t *buf, size_t max_size)
break;
}
- const auto type = (*service)->getType(ensemble);
+ const bool is_programme = (*service)->isProgramme(ensemble);
- if ( (type == subchannel_type_t::DABPlusAudio or type == subchannel_type_t::DABAudio) and
- (*service)->label.has_fig1_label()) {
+ if (is_programme and (*service)->label.has_fig1_label()) {
auto fig1_1 = (FIGtype1_1 *)buf;
fig1_1->FIGtypeNumber = 1;
@@ -155,10 +154,8 @@ 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 (type == subchannel_type_t::DABAudio or type == subchannel_type_t::DABPlusAudio) {
+ if ((*service)->isProgramme(ensemble)) {
if (remaining < 5 + 16 + 2) {
break;
diff --git a/src/fig/FIG2.cpp b/src/fig/FIG2.cpp
index afa64eb..b88814c 100644
--- a/src/fig/FIG2.cpp
+++ b/src/fig/FIG2.cpp
@@ -202,8 +202,7 @@ FillStatus FIG2_1_and_5::fill(uint8_t *buf, size_t max_size)
// Rotate through the subchannels until there is no more space
while (service != ensemble->services.end()) {
- const bool is_programme = (*service)->getType(ensemble) == subchannel_type_t::DABAudio or
- ((*service)->getType(ensemble) == subchannel_type_t::DABPlusAudio);
+ const bool is_programme = (*service)->isProgramme(ensemble);
if (not (m_programme xor is_programme) and (*service)->label.has_fig2_label()) {
@@ -316,8 +315,7 @@ FillStatus FIG2_4::fill(uint8_t *buf, size_t max_size)
}
}
- const bool is_programme = (*service)->getType(ensemble) == subchannel_type_t::DABAudio or
- ((*service)->getType(ensemble) == subchannel_type_t::DABPlusAudio);
+ const bool is_programme = (*service)->isProgramme(ensemble);
const size_t id_length = is_programme ?
sizeof(FIGtype2_4_Programme_Identifier) :