diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ConfigParser.cpp | 6 | ||||
-rw-r--r-- | src/MuxElements.h | 3 | ||||
-rw-r--r-- | src/fig/FIG0_14.cpp | 38 | ||||
-rw-r--r-- | src/fig/FIG0_14.h | 3 |
4 files changed, 23 insertions, 27 deletions
diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp index 1839316..eb30e3a 100644 --- a/src/ConfigParser.cpp +++ b/src/ConfigParser.cpp @@ -3,7 +3,7 @@ 2011, 2012 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2020 + Copyright (C) 2022 Matthias P. Braendli, matthias.braendli@mpb.li http://www.opendigitalradio.org @@ -1077,8 +1077,8 @@ static void setup_subchannel_from_ptree(shared_ptr<DabSubchannel>& subchan, subchan->type = subchannel_type_t::Packet; subchan->bitrate = DEFAULT_PACKET_BITRATE; - bool enhanced = (type == "enhancedpacket"); - subchan->input = make_shared<Inputs::PacketFile>(enhanced); + subchan->packet_enhanced = (type == "enhancedpacket"); + subchan->input = make_shared<Inputs::PacketFile>(subchan->packet_enhanced); } else { stringstream ss; diff --git a/src/MuxElements.h b/src/MuxElements.h index 90f39a6..020093d 100644 --- a/src/MuxElements.h +++ b/src/MuxElements.h @@ -3,7 +3,7 @@ 2011, 2012 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2020 + Copyright (C) 2022 Matthias P. Braendli, matthias.braendli@mpb.li http://www.opendigitalradio.org @@ -418,6 +418,7 @@ public: std::shared_ptr<Inputs::InputBase> input; unsigned char id = 0; subchannel_type_t type = subchannel_type_t::DABAudio; + bool packet_enhanced = false; // Enables additional FEC and FIG0/14 uint16_t startAddress = 0; uint16_t bitrate = 0; struct dabProtection protection; diff --git a/src/fig/FIG0_14.cpp b/src/fig/FIG0_14.cpp index 72bcfff..e3264ff 100644 --- a/src/fig/FIG0_14.cpp +++ b/src/fig/FIG0_14.cpp @@ -3,9 +3,9 @@ 2011, 2012 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2020 + Copyright (C) 2022 Matthias P. Braendli, matthias.braendli@mpb.li - + Copyright (C) 2022 Nick Piggott, nick@piggott.eu */ @@ -32,7 +32,7 @@ namespace FIC { -// See EN 300 401, Clause 6.2.2 for the FIG0_14 description +// See EN 300 401, Clause 6.2.2 for the FIG0/14 description struct FIG0_14_AppInfo { uint8_t fecScheme:2; @@ -53,17 +53,15 @@ FillStatus FIG0_14::fill(uint8_t *buf, size_t max_size) ssize_t remaining = max_size; if (not m_initialised) { - componentFIG0_14 = m_rti->ensemble->components.end(); + componentFIG0_14 = m_rti->ensemble->components.begin(); m_initialised = true; } - FIGtype0* fig0 = NULL; - - for (; componentFIG0_14 != ensemble->components.end(); - ++componentFIG0_14) { + FIGtype0 *fig0 = nullptr; - auto subchannel = getSubchannel(ensemble->subchannels, - (*componentFIG0_14)->subchId); + for (; componentFIG0_14 != ensemble->components.end(); ++componentFIG0_14) { + const auto subchannel = getSubchannel( + ensemble->subchannels, (*componentFIG0_14)->subchId); if (subchannel == ensemble->subchannels.end()) { etiLog.log(error, @@ -74,14 +72,12 @@ FillStatus FIG0_14::fill(uint8_t *buf, size_t max_size) continue; } - if ( ((*subchannel)->type == subchannel_type_t::Packet and - true)) { // Need to do a test here to see if a packet channel is normal or enhanced - - static_assert(sizeof(FIG0_14_AppInfo) == 1); + if ((*subchannel)->type == subchannel_type_t::Packet and + (*subchannel)->packet_enhanced) { int required_size = 1; // FIG0_14 data field is 6 bits subchanID and 2 bits fec scheme - - if (fig0 == NULL) { + + if (fig0 == nullptr) { if (remaining < 2 + required_size) { break; } @@ -98,10 +94,13 @@ FillStatus FIG0_14::fill(uint8_t *buf, size_t max_size) else if (remaining < required_size) { break; } + + static_assert(sizeof(FIG0_14_AppInfo) == 1); + /* No alignment issues in this cast because the sizeof() == 1 */ FIG0_14_AppInfo* app = (FIG0_14_AppInfo*)buf; app->subchId = (*componentFIG0_14)->subchId; - app->fecScheme = 1; // only 1 fec_scheme is defined - buf += 1 ; + app->fecScheme = 1; // 1=FEC Scheme according to EN 300 401 clause 5.3.5 is the only value allowed + buf += 1; remaining -= 1; fig0->Length += 1; } @@ -109,13 +108,10 @@ FillStatus FIG0_14::fill(uint8_t *buf, size_t max_size) if (componentFIG0_14 == ensemble->components.end()) { componentFIG0_14 = ensemble->components.begin(); - fs.complete_fig_transmitted = true; - } fs.num_bytes_written = max_size - remaining; return fs; } - } diff --git a/src/fig/FIG0_14.h b/src/fig/FIG0_14.h index 0b46683..b713c72 100644 --- a/src/fig/FIG0_14.h +++ b/src/fig/FIG0_14.h @@ -5,7 +5,7 @@ Copyright (C) 2020 Matthias P. Braendli, matthias.braendli@mpb.li - + Copyright (C) 2022 Nick Piggott, nick@piggott.eu */ @@ -48,7 +48,6 @@ class FIG0_14 : public IFIG private: FIGRuntimeInformation *m_rti; bool m_initialised; - bool m_transmit_programme; vec_sp_component::iterator componentFIG0_14; }; |