From a9814a2a8e02928d69b28247b3e7c2a468d8987b Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 15 Aug 2015 22:31:22 +0200 Subject: Move FIG completion flag after loops --- src/fig/FIG0.cpp | 75 ++++++++++++++++++++++++++++---------------------------- src/fig/FIG1.cpp | 30 +++++++++++------------ 2 files changed, 53 insertions(+), 52 deletions(-) (limited to 'src/fig') diff --git a/src/fig/FIG0.cpp b/src/fig/FIG0.cpp index 6c3b6dc..3d058a8 100644 --- a/src/fig/FIG0.cpp +++ b/src/fig/FIG0.cpp @@ -101,11 +101,6 @@ FillStatus FIG0_1::fill(uint8_t *buf, size_t max_size) // Rotate through the subchannels until there is no more // space in the FIG0/1 - if (subchannelFIG0_1 == ensemble->subchannels.end()) { - subchannelFIG0_1 = ensemble->subchannels.begin(); - fs.complete_fig_transmitted = true; - } - for (; subchannelFIG0_1 != ensemble->subchannels.end(); ++subchannelFIG0_1) { dabProtection* protection = &(*subchannelFIG0_1)->protection; @@ -160,6 +155,11 @@ FillStatus FIG0_1::fill(uint8_t *buf, size_t max_size) } } + if (subchannelFIG0_1 == ensemble->subchannels.end()) { + subchannelFIG0_1 = ensemble->subchannels.begin(); + fs.complete_fig_transmitted = true; + } + fs.num_bytes_written = max_size - remaining; return fs; } @@ -189,11 +189,6 @@ FillStatus FIG0_2::fill(uint8_t *buf, size_t max_size) // Rotate through the subchannels until there is no more // space - if (serviceFIG0_2 == ensemble->services.end()) { - serviceFIG0_2 = ensemble->services.begin(); - fs.complete_fig_transmitted = true; - } - for (; serviceFIG0_2 != ensemble->services.end(); ++serviceFIG0_2) { @@ -328,6 +323,12 @@ FillStatus FIG0_2::fill(uint8_t *buf, size_t max_size) ++curCpnt; } } + + if (serviceFIG0_2 == ensemble->services.end()) { + serviceFIG0_2 = ensemble->services.begin(); + fs.complete_fig_transmitted = true; + } + fs.num_bytes_written = max_size - remaining; return fs; } @@ -438,11 +439,6 @@ FillStatus FIG0_8::fill(uint8_t *buf, size_t max_size) FIGtype0* fig0 = NULL; - if (componentFIG0_8 == ensemble->components.end()) { - componentFIG0_8 = ensemble->components.begin(); - fs.complete_fig_transmitted = true; - } - for (; componentFIG0_8 != ensemble->components.end(); ++componentFIG0_8) { auto service = getService(*componentFIG0_8, @@ -562,6 +558,11 @@ FillStatus FIG0_8::fill(uint8_t *buf, size_t max_size) } } + if (componentFIG0_8 == ensemble->components.end()) { + componentFIG0_8 = ensemble->components.begin(); + fs.complete_fig_transmitted = true; + } + fs.num_bytes_written = max_size - remaining; return fs; } @@ -721,18 +722,6 @@ FillStatus FIG0_13::fill(uint8_t *buf, size_t max_size) FIGtype0* fig0 = NULL; - if (componentFIG0_13 == ensemble->components.end()) { - componentFIG0_13 = ensemble->components.begin(); - - // The full database is sent every second full loop - fs.complete_fig_transmitted = m_transmit_programme; - - m_transmit_programme = not m_transmit_programme; - // Alternate between data and and programme FIG0/13, - // do not mix fig0 with PD=0 with extension 13 stuff - // that actually needs PD=1, and vice versa - } - for (; componentFIG0_13 != ensemble->components.end(); ++componentFIG0_13) { @@ -830,6 +819,18 @@ FillStatus FIG0_13::fill(uint8_t *buf, size_t max_size) } } + if (componentFIG0_13 == ensemble->components.end()) { + componentFIG0_13 = ensemble->components.begin(); + + // The full database is sent every second full loop + fs.complete_fig_transmitted = m_transmit_programme; + + m_transmit_programme = not m_transmit_programme; + // Alternate between data and and programme FIG0/13, + // do not mix fig0 with PD=0 with extension 13 stuff + // that actually needs PD=1, and vice versa + } + fs.num_bytes_written = max_size - remaining; return fs; } @@ -856,11 +857,6 @@ FillStatus FIG0_17::fill(uint8_t *buf, size_t max_size) FIGtype0* fig0 = NULL; - if (serviceFIG0_17 == ensemble->services.end()) { - serviceFIG0_17 = ensemble->services.begin(); - fs.complete_fig_transmitted = true; - } - for (; serviceFIG0_17 != ensemble->services.end(); ++serviceFIG0_17) { @@ -915,6 +911,11 @@ FillStatus FIG0_17::fill(uint8_t *buf, size_t max_size) } } + if (serviceFIG0_17 == ensemble->services.end()) { + serviceFIG0_17 = ensemble->services.begin(); + fs.complete_fig_transmitted = true; + } + fs.num_bytes_written = max_size - remaining; return fs; } @@ -941,11 +942,6 @@ FillStatus FIG0_18::fill(uint8_t *buf, size_t max_size) FIGtype0* fig0 = NULL; - if (service == ensemble->services.end()) { - service = ensemble->services.begin(); - fs.complete_fig_transmitted = true; - } - for (; service != ensemble->services.end(); ++service) { @@ -990,6 +986,11 @@ FillStatus FIG0_18::fill(uint8_t *buf, size_t max_size) remaining -= 5 + numclusters; } + if (service == ensemble->services.end()) { + service = ensemble->services.begin(); + fs.complete_fig_transmitted = true; + } + fs.num_bytes_written = max_size - remaining; return fs; } diff --git a/src/fig/FIG1.cpp b/src/fig/FIG1.cpp index 160c3b9..46e7c4b 100644 --- a/src/fig/FIG1.cpp +++ b/src/fig/FIG1.cpp @@ -84,11 +84,6 @@ FillStatus FIG1_1::fill(uint8_t *buf, size_t max_size) // Rotate through the subchannels until there is no more // space - if (service == ensemble->services.end()) { - service = ensemble->services.begin(); - fs.complete_fig_transmitted = true; - } - for (; service != ensemble->services.end(); ++service) { @@ -120,6 +115,11 @@ FillStatus FIG1_1::fill(uint8_t *buf, size_t max_size) } } + if (service == ensemble->services.end()) { + service = ensemble->services.begin(); + fs.complete_fig_transmitted = true; + } + fs.num_bytes_written = max_size - remaining; return fs; } @@ -141,11 +141,6 @@ FillStatus FIG1_4::fill(uint8_t *buf, size_t max_size) // Rotate through the subchannels until there is no more // space - if (component == ensemble->components.end()) { - component = ensemble->components.begin(); - fs.complete_fig_transmitted = true; - } - for (; component != ensemble->components.end(); ++component) { @@ -207,6 +202,11 @@ FillStatus FIG1_4::fill(uint8_t *buf, size_t max_size) } } + if (component == ensemble->components.end()) { + component = ensemble->components.begin(); + fs.complete_fig_transmitted = true; + } + fs.num_bytes_written = max_size - remaining; return fs; } @@ -228,11 +228,6 @@ FillStatus FIG1_5::fill(uint8_t *buf, size_t max_size) // Rotate through the subchannels until there is no more // space - if (service == ensemble->services.end()) { - service = ensemble->services.begin(); - fs.complete_fig_transmitted = true; - } - for (; service != ensemble->services.end(); ++service) { @@ -263,6 +258,11 @@ FillStatus FIG1_5::fill(uint8_t *buf, size_t max_size) } } + if (service == ensemble->services.end()) { + service = ensemble->services.begin(); + fs.complete_fig_transmitted = true; + } + fs.num_bytes_written = max_size - remaining; return fs; } -- cgit v1.2.3