X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/cf214285bf32c54a64b226096f919ed1db007b77..95039ba3e50f5df85e6e1e2d4108486fd28f2264:/lib/dvb/scan.cpp diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp index 961812f6..7f4f6b10 100644 --- a/lib/dvb/scan.cpp +++ b/lib/dvb/scan.cpp @@ -104,7 +104,6 @@ RESULT eDVBScan::nextChannel() } m_ch_current = m_ch_toScan.front(); - m_chid_current = eDVBChannelID(); m_ch_toScan.pop_front(); @@ -113,7 +112,18 @@ RESULT eDVBScan::nextChannel() m_event(evtFail); return -ENOTSUP; } - + + int fetype; + fe->getFrontendType(fetype); + if ( fetype == iDVBFrontend::feSatellite) + { + eDVBFrontendParametersSatellite p; + m_ch_current->getDVBS(p); + m_chid_current = eDVBChannelID(p.orbital_position << 16, -1, -1); + } + else + m_chid_current = eDVBChannelID(); + m_channel_state = iDVBChannel::state_idle; if (fe->tune(*m_ch_current)) { @@ -221,7 +231,7 @@ void eDVBScan::addChannelToScan(const eDVBChannelID &chid, iDVBFrontendParameter return; /* otherwise, add it to the todo list. */ - m_ch_toScan.push_back(feparm); + m_ch_toScan.push_front(feparm); // better.. then the rotor not turning wild from east to west :) } int eDVBScan::sameChannel(iDVBFrontendParameters *ch1, iDVBFrontendParameters *ch2) const @@ -301,7 +311,8 @@ void eDVBScan::channelDone() eDVBNamespace ns = buildNamespace(onid, tsid, hash); - if (m_chid_current && ((ns.get() ^ m_chid_current.dvbnamespace.get()) & 0xFFFF0000)) + if ( m_chid_current.dvbnamespace.get() != -1 && + ((ns.get() ^ m_chid_current.dvbnamespace.get()) & 0xFFFF0000)) eDebug("dropping this transponder, it's on another satellite."); else { @@ -364,7 +375,23 @@ void eDVBScan::start(const eSmartPtrList &known_transpon m_ch_unavailable.clear(); m_new_channels.clear(); m_new_services.clear(); - m_ch_toScan.insert(m_ch_toScan.end(), known_transponders.begin(), known_transponders.end()); + m_last_service = m_new_services.end(); + + for (eSmartPtrList::const_iterator i(known_transponders.begin()); i != known_transponders.end(); ++i) + { + bool exist=false; + for (std::list >::const_iterator ii(m_ch_toScan.begin()); ii != m_ch_toScan.end(); ++ii) + { + if (sameChannel(*i, *ii)) + { + exist=true; + break; + } + } + if (!exist) + m_ch_toScan.push_back(*i); + } + nextChannel(); } @@ -443,7 +470,13 @@ RESULT eDVBScan::processSDT(eDVBNamespace dvbnamespace, const ServiceDescription } } - m_new_services.insert(std::pair >(ref, service)); + std::pair >::iterator, bool> i = m_new_services.insert(std::pair >(ref, service)); + + if (i.second) + { + m_last_service = i.first; + m_event(evtNewService); + } } return 0; } @@ -460,3 +493,11 @@ void eDVBScan::getStats(int &transponders_done, int &transponders_total, int &se transponders_total = m_ch_toScan.size() + transponders_done; services = m_new_services.size(); } + +void eDVBScan::getLastServiceName(std::string &last_service_name) +{ + if (m_last_service == m_new_services.end()) + last_service_name = ""; + else + last_service_name = m_last_service->second->m_service_name; +}