- fix scan: initial transponder wasn't used.
authorFelix Domke <tmbinc@elitedvb.net>
Mon, 26 Sep 2005 17:24:10 +0000 (17:24 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Mon, 26 Sep 2005 17:24:10 +0000 (17:24 +0000)
lib/dvb/scan.cpp
lib/dvb/scan.h

index 4b31aadaed0ecdf2b8c308a5b3edb3f1d2597ae9..7e60331411d2821024854f64d69e52dbc4566f94 100644 (file)
@@ -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<eDVBChannelID,ePtr<iDVBFrontendParameters> >(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());
index fb6b56f405cce9d0faa31b9a6042eefd1420fbde..743ea8d963f272fda92122bc4c497ba8d1e5f3ee 100644 (file)
@@ -43,6 +43,7 @@ private:
        
        std::list<ePtr<iDVBFrontendParameters> > m_ch_toScan, m_ch_scanned, m_ch_unavailable;
        ePtr<iDVBFrontendParameters> m_ch_current;
+       eDVBChannelID m_chid_current;
        
        ePtr<eTable<ServiceDescriptionTable> > m_SDT;
        ePtr<eTable<NetworkInformationTable> > 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();