From 865b494130c35c6bda653b196fdbc61890ea76b5 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Mon, 26 Sep 2005 17:24:10 +0000 Subject: [PATCH] - fix scan: initial transponder wasn't used. --- lib/dvb/scan.cpp | 42 +++++++++++++++++++++++++++++++++++++++--- lib/dvb/scan.h | 4 +++- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp index 4b31aada..7e603314 100644 --- a/lib/dvb/scan.cpp +++ b/lib/dvb/scan.cpp @@ -93,6 +93,8 @@ RESULT eDVBScan::nextChannel() } m_ch_current = m_ch_toScan.front(); + m_chid_current = eDVBChannelID(); + m_ch_toScan.pop_front(); if (m_channel->getFrontend(fe)) @@ -163,12 +165,15 @@ void eDVBScan::BATready(int err) channelDone(); } -void eDVBScan::addChannel(const eDVBChannelID &chid, iDVBFrontendParameters *feparm) +void eDVBScan::addKnownGoodChannel(const eDVBChannelID &chid, iDVBFrontendParameters *feparm) { /* add it to the list of known channels. */ if (chid) m_new_channels.insert(std::pair >(chid, feparm)); - +} + +void eDVBScan::addChannelToScan(const eDVBChannelID &chid, iDVBFrontendParameters *feparm) +{ /* check if we don't already have that channel ... */ /* ... in the list of channels to scan */ @@ -271,7 +276,7 @@ void eDVBScan::channelDone() eDVBNamespace ns = buildNamespace(onid, tsid, hash); - addChannel( + addChannelToScan( eDVBChannelID(ns, tsid, onid), feparm); break; @@ -290,6 +295,33 @@ void eDVBScan::channelDone() if ((m_ready & readyAll) != readyAll) return; SCAN_eDebug("channel done!"); + + /* if we had services on this channel, we declare + this channels as "known good". add it. + + (TODO: not yet implemented) + a NIT entry could have possible overridden + our frontend data with more exact data. + + (TODO: not yet implemented) + the tuning process could have lead to more + exact data than the user entered. + + The channel id was probably corrected + by the data written in the SDT. this is + important, as "initial transponder lists" + usually don't have valid CHIDs (and that's + good). + + These are the reasons for adding the transponder + here, and not before. + */ + + 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); nextChannel(); } @@ -327,6 +359,10 @@ RESULT eDVBScan::processSDT(eDVBNamespace dvbnamespace, const ServiceDescription SCAN_eDebug("ONID: %04x", sdt.getOriginalNetworkId()); eDVBChannelID chid(dvbnamespace, sdt.getTransportStreamId(), sdt.getOriginalNetworkId()); + /* save correct CHID for this channel if this is an ACTUAL_SDT */ + if (sdt.getTableId() == TID_SDT_ACTUAL) + m_chid_current = chid; + for (ServiceDescriptionConstIterator s(services.begin()); s != services.end(); ++s) { SCAN_eDebugNoNewLine("SID %04x: ", (*s)->getServiceId()); diff --git a/lib/dvb/scan.h b/lib/dvb/scan.h index fb6b56f4..743ea8d9 100644 --- a/lib/dvb/scan.h +++ b/lib/dvb/scan.h @@ -43,6 +43,7 @@ private: std::list > m_ch_toScan, m_ch_scanned, m_ch_unavailable; ePtr m_ch_current; + eDVBChannelID m_chid_current; ePtr > m_SDT; ePtr > m_NIT; @@ -52,7 +53,8 @@ private: void NITready(int err); void BATready(int err); - void addChannel(const eDVBChannelID &chid, iDVBFrontendParameters *feparm); + void addKnownGoodChannel(const eDVBChannelID &chid, iDVBFrontendParameters *feparm); + void addChannelToScan(const eDVBChannelID &chid, iDVBFrontendParameters *feparm); int sameChannel(iDVBFrontendParameters *ch1, iDVBFrontendParameters *ch2) const; void channelDone(); -- 2.30.2