X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/6be1d64932f7007baa7974f72724a97dd6c7304e..ba1b105a176e5f62faf9d6d1f4c1a4c19764a2e4:/lib/dvb/scan.cpp diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp index f49607c2..3c952b8f 100644 --- a/lib/dvb/scan.cpp +++ b/lib/dvb/scan.cpp @@ -283,14 +283,33 @@ void eDVBScan::addChannelToScan(const eDVBChannelID &chid, iDVBFrontendParameter } } + int found_count=0; /* ... in the list of channels to scan */ - for (std::list >::iterator i(m_ch_toScan.begin()); i != m_ch_toScan.end(); ++i) + for (std::list >::iterator i(m_ch_toScan.begin()); i != m_ch_toScan.end();) + { if (sameChannel(*i, feparm)) { - *i = feparm; // update - eDebug("update"); - return; + if (!found_count) + { + *i = feparm; // update + eDebug("update"); + } + else + { + eDebug("remove dupe"); + m_ch_toScan.erase(i++); + continue; + } + ++found_count; } + ++i; + } + + if (found_count > 0) + { + eDebug("already in todo list"); + return; + } /* ... in the list of successfully scanned channels */ for (std::list >::const_iterator i(m_ch_scanned.begin()); i != m_ch_scanned.end(); ++i) @@ -357,12 +376,13 @@ void eDVBScan::channelDone() if (m_ready & validNIT) { int system; + std::list > m_ch_toScan_backup; m_ch_current->getSystem(system); SCAN_eDebug("dumping NIT"); if (m_flags & clearToScanOnFirstNIT) { + m_ch_toScan_backup = m_ch_toScan; m_ch_toScan.clear(); - m_flags &= ~clearToScanOnFirstNIT; } std::vector::const_iterator i; for (i = m_NIT->getSections().begin(); i != m_NIT->getSections().end(); ++i) @@ -455,9 +475,25 @@ void eDVBScan::channelDone() break; } } - } + } + + /* a pitfall is to have the clearToScanOnFirstNIT-flag set, and having channels which have + no or invalid NIT. this code will not erase the toScan list unless at least one valid entry + has been found. + + This is not a perfect solution, as the channel could contain a partial NIT. Life's bad. + */ + if (m_flags & clearToScanOnFirstNIT) + { + if (m_ch_toScan.empty()) + { + eWarning("clearToScanOnFirstNIT was set, but NIT is invalid. Refusing to stop scan."); + m_ch_toScan = m_ch_toScan_backup; + } else + m_flags &= ~clearToScanOnFirstNIT; + } m_ready &= ~validNIT; } @@ -489,9 +525,23 @@ void eDVBScan::channelDone() if (!m_chid_current) eWarning("SCAN: the current channel's ID was not corrected - not adding channel."); else + { addKnownGoodChannel(m_chid_current, m_ch_current); - m_ch_scanned.push_back(m_ch_current); + m_ch_scanned.push_back(m_ch_current); + + for (std::list >::iterator i(m_ch_toScan.begin()); i != m_ch_toScan.end();) + { + if (sameChannel(*i, m_ch_current)) + { + eDebug("remove dupe 2"); + m_ch_toScan.erase(i++); + continue; + } + ++i; + } + } + nextChannel(); } @@ -510,7 +560,7 @@ void eDVBScan::start(const eSmartPtrList &known_transpon bool exist=false; for (std::list >::const_iterator ii(m_ch_toScan.begin()); ii != m_ch_toScan.end(); ++ii) { - if (sameChannel(*i, *ii)) + if (sameChannel(*i, *ii, true)) { exist=true; break;