diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-08-17 17:39:05 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-08-17 17:39:05 +0200 |
commit | 8166d7777de15266cf97de3e43ef7125a9c26761 (patch) | |
tree | c52f6d3d283c0a024b41c7d2ab34eb0b16407bd0 /src/DabMultiplexer.cpp | |
parent | dbac3d701cded9545f555dde41d8e29a4d38c020 (diff) | |
download | dabmux-8166d7777de15266cf97de3e43ef7125a9c26761.tar.gz dabmux-8166d7777de15266cf97de3e43ef7125a9c26761.tar.bz2 dabmux-8166d7777de15266cf97de3e43ef7125a9c26761.zip |
Add ability to map FIG to any FIB
Move CRC calculation into FIGCarousel
Diffstat (limited to 'src/DabMultiplexer.cpp')
-rw-r--r-- | src/DabMultiplexer.cpp | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp index c7a5554..ea5a582 100644 --- a/src/DabMultiplexer.cpp +++ b/src/DabMultiplexer.cpp @@ -32,7 +32,7 @@ using namespace std; using namespace boost; -static unsigned char Padding_FIB[] = { +static const unsigned char Padding_FIB[] = { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -635,17 +635,16 @@ void DabMultiplexer::mux_frame(std::vector<boost::shared_ptr<DabOutput> >& outpu tm* timeData; - unsigned char figSize = 0; - - // FIB 0 Insertion + // Insert all FIBs if (m_use_new_fig_carousel) { fig_carousel.update(currentFrame, date); - figSize += fig_carousel.carousel(0, &etiFrame[index], 30, currentFrame % 4); - index += figSize; + const bool fib3_present = ensemble->mode == 3; + index += fig_carousel.write_fibs(&etiFrame[index], currentFrame % 4, fib3_present); } - // Skip creating a block for the else because - // I don't want to reindent the whole switch block - else switch (insertFIG) { + else { + unsigned char figSize = 0; + // FIB 0 Insertion + switch (insertFIG) { case 0: case 4: @@ -1136,10 +1135,7 @@ void DabMultiplexer::mux_frame(std::vector<boost::shared_ptr<DabOutput> >& outpu figSize = 0; // FIB 1 insertion - if (m_use_new_fig_carousel) { - figSize += fig_carousel.carousel(1, &etiFrame[index], 30, currentFrame % 4); - index += figSize; - } else switch (rotateFIB) { + switch (rotateFIB) { case 0: // FIG 0/8 program fig0 = NULL; @@ -1536,11 +1532,7 @@ void DabMultiplexer::mux_frame(std::vector<boost::shared_ptr<DabOutput> >& outpu figSize = 0; // FIB 2 insertion - if (m_use_new_fig_carousel) { - figSize += fig_carousel.carousel(2, &etiFrame[index], 30, currentFrame % 4); - index += figSize; - } - else if (rotateFIB < ensemble->services.size()) { + if (rotateFIB < ensemble->services.size()) { service = ensemble->services.begin() + rotateFIB; // FIG type 1/1, SI, Service label, one instance per subchannel @@ -1661,8 +1653,7 @@ void DabMultiplexer::mux_frame(std::vector<boost::shared_ptr<DabOutput> >& outpu etiFrame[index++] = ((char *) &CRCtmp)[0]; } - if ( !m_use_new_fig_carousel and - ensemble->services.size() > 30) { + if (ensemble->services.size() > 30) { etiLog.log(error, "Sorry, but this software currently can't write " "Service Label of more than 30 services.\n"); @@ -1674,6 +1665,7 @@ void DabMultiplexer::mux_frame(std::vector<boost::shared_ptr<DabOutput> >& outpu // We rotate through the FIBs every 30 frames rotateFIB = (rotateFIB + 1) % 30; + } /********************************************************************** ****** Input Data Reading ******************************************* |