X-Git-Url: http://code.vuplus.com/gitweb/?a=blobdiff_plain;f=lib%2Fdvb%2Fscan.cpp;h=8b895dc9f8a42a59ea959604e162a033bb2f0a30;hb=6dcb75c26bbfec04b381bb99d75404f9fe50635d;hp=d21ed10b13bae1a2295c82c14c1b7e51c63b0fbc;hpb=196634a2be3f5cbac64aeefc6e0aaef142115567;p=vuplus_dvbapp diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp index d21ed10..8b895dc 100644 --- a/lib/dvb/scan.cpp +++ b/lib/dvb/scan.cpp @@ -268,7 +268,7 @@ void eDVBScan::addChannelToScan(const eDVBChannelID &chid, iDVBFrontendParameter { eDVBFrontendParametersCable parm; feparm->getDVBC(parm); - eDebug("try to add %d %d %d %d %d", + eDebug("try to add %d %d %d %d", parm.frequency, parm.symbol_rate, parm.modulation, parm.fec_inner); break; } @@ -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) @@ -356,7 +375,14 @@ void eDVBScan::channelDone() if (m_ready & validNIT) { + int system; + m_ch_current->getSystem(system); SCAN_eDebug("dumping NIT"); + if (m_flags & clearToScanOnFirstNIT) + { + m_ch_toScan.clear(); + m_flags &= ~clearToScanOnFirstNIT; + } std::vector::const_iterator i; for (i = m_NIT->getSections().begin(); i != m_NIT->getSections().end(); ++i) { @@ -378,6 +404,8 @@ void eDVBScan::channelDone() { case CABLE_DELIVERY_SYSTEM_DESCRIPTOR: { + if (system != iDVBFrontend::feCable) + break; // when current locked transponder is no cable transponder ignore this descriptor CableDeliverySystemDescriptor &d = (CableDeliverySystemDescriptor&)**desc; ePtr feparm = new eDVBFrontendParameters; eDVBFrontendParametersCable cable; @@ -395,6 +423,8 @@ void eDVBScan::channelDone() } case TERRESTRIAL_DELIVERY_SYSTEM_DESCRIPTOR: { + if (system != iDVBFrontend::feTerrestrial) + break; // when current locked transponder is no terrestrial transponder ignore this descriptor TerrestrialDeliverySystemDescriptor &d = (TerrestrialDeliverySystemDescriptor&)**desc; ePtr feparm = new eDVBFrontendParameters; eDVBFrontendParametersTerrestrial terr; @@ -412,6 +442,9 @@ void eDVBScan::channelDone() } case SATELLITE_DELIVERY_SYSTEM_DESCRIPTOR: { + if (system != iDVBFrontend::feSatellite) + break; // when current locked transponder is no satellite transponder ignore this descriptor + SatelliteDeliverySystemDescriptor &d = (SatelliteDeliverySystemDescriptor&)**desc; if (d.getFrequency() < 10000) break; @@ -475,9 +508,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(); } @@ -496,7 +543,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;