From cdd4f414c25ee5f0f8a376abcba2adb7f3aa84f0 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 7 Aug 2015 15:45:25 +0200 Subject: Add FIB2 insertion --- src/DabMultiplexer.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp index e775c96..e9fb0c1 100644 --- a/src/DabMultiplexer.cpp +++ b/src/DabMultiplexer.cpp @@ -1115,7 +1115,7 @@ void DabMultiplexer::mux_frame(std::vector >& outpu if (figSize > 30) { etiLog.log(error, - "FIG too big (%i > 30)\n", figSize); + "FIB0 overload (%i > 30)\n", figSize); throw MuxInitException(); } @@ -1512,7 +1512,12 @@ void DabMultiplexer::mux_frame(std::vector >& outpu break; } - assert(figSize <= 30); + if (figSize > 30) { + etiLog.log(error, + "FIB1 overload (%i > 30)\n", figSize); + throw MuxInitException(); + } + memcpy(&etiFrame[index], Padding_FIB, 30 - figSize); index += 30 - figSize; @@ -1525,7 +1530,11 @@ void DabMultiplexer::mux_frame(std::vector >& outpu figSize = 0; // FIB 2 insertion - if (rotateFIB < ensemble->services.size()) { + if (new_fig_carousel) { + figSize += fig_carousel.carousel(2, &etiFrame[index], 30, currentFrame % 4); + index += figSize; + } + else if (rotateFIB < ensemble->services.size()) { service = ensemble->services.begin() + rotateFIB; // FIG type 1/1, SI, Service label, one instance per subchannel @@ -1615,6 +1624,12 @@ void DabMultiplexer::mux_frame(std::vector >& outpu figSize += 2; } } + + if (figSize > 30) { + etiLog.log(error, + "FIB2 overload (%i > 30)\n", figSize); + throw MuxInitException(); + } memcpy(&etiFrame[index], Padding_FIB, 30 - figSize); index += 30 - figSize; @@ -1630,6 +1645,7 @@ void DabMultiplexer::mux_frame(std::vector >& outpu */ if (ensemble->mode == 3) { memcpy(&etiFrame[index], Padding_FIB, 30); + /* Fill FIB3 with padding */ index += 30; CRCtmp = 0xffff; @@ -1639,7 +1655,8 @@ void DabMultiplexer::mux_frame(std::vector >& outpu etiFrame[index++] = ((char *) &CRCtmp)[0]; } - if (ensemble->services.size() > 30) { + if ( !new_fig_carousel and + ensemble->services.size() > 30) { etiLog.log(error, "Sorry, but this software currently can't write " "Service Label of more than 30 services.\n"); -- cgit v1.2.3