code cleanup
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Tue, 25 Jul 2006 20:38:38 +0000 (20:38 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Tue, 25 Jul 2006 20:38:38 +0000 (20:38 +0000)
lib/dvb/epgcache.cpp
lib/dvb/epgcache.h

index ba77745..8283fba 100644 (file)
@@ -286,7 +286,7 @@ void eEPGCache::DVBChannelStateChanged(iDVBChannel *chan)
                                {
                                        eDebug("[eEPGCache] remove channel %p", chan);
                                        messages.send(Message(Message::leaveChannel, chan));
-                                       while(!it->second->can_delete)
+                                       while(!it->second->canDelete())
                                                usleep(1000);
                                        delete it->second;
                                        m_knownChannels.erase(it);
@@ -983,7 +983,7 @@ void eEPGCache::save()
 eEPGCache::channel_data::channel_data(eEPGCache *ml)
        :cache(ml)
        ,abortTimer(ml), zapTimer(ml),state(0)
-       ,isRunning(0), haveData(0), can_delete(1)
+       ,isRunning(0), haveData(0)
        ,startPrivateTimer(ml)
 {
        CONNECT(zapTimer.timeout, eEPGCache::channel_data::startEPG);
@@ -1005,10 +1005,6 @@ bool eEPGCache::channel_data::finishEPG()
                }
                singleLock l(cache->cache_lock);
                cache->channelLastUpdated[channel->getChannelID()] = eDVBLocalTimeHandler::getInstance()->nowTime();
-#ifdef ENABLE_PRIVATE_EPG
-               if (seenPrivateSections.empty())
-#endif
-               can_delete=1;
                return true;
        }
        return false;
@@ -1019,7 +1015,6 @@ void eEPGCache::channel_data::startEPG()
        eDebug("[EPGC] start caching events(%ld)", eDVBLocalTimeHandler::getInstance()->nowTime());
        state=0;
        haveData=0;
-       can_delete=0;
        for (int i=0; i < 3; ++i)
        {
                seenSections[i].clear();
@@ -1087,10 +1082,6 @@ void eEPGCache::channel_data::abortNonAvail()
                                seenSections[i].clear();
                                calcedSections[i].clear();
                        }
-#ifdef ENABLE_PRIVATE_EPG
-                       if (seenPrivateSections.empty())
-#endif
-                       can_delete=1;
                }
        }
        ++state;
@@ -1149,7 +1140,6 @@ void eEPGCache::channel_data::abortEPG()
        if (m_PrivateConn)
                m_PrivateConn=0;
 #endif
-       can_delete=1;
 }
 
 void eEPGCache::channel_data::readData( const __u8 *data)
@@ -2419,15 +2409,12 @@ void eEPGCache::channel_data::readPrivateData( const __u8 *data)
        {
                if ( seenPrivateSections.find( data[6] ) == seenPrivateSections.end() )
                {
-                       can_delete = 0;
                        cache->privateSectionRead(m_PrivateService, data);
                        seenPrivateSections.insert(data[6]);
                }
                if ( seenPrivateSections.size() == (unsigned int)(data[7] + 1) )
                {
                        eDebug("[EPGC] private finished");
-                       if (!isRunning)
-                               can_delete = 1;
                        m_PrevVersion = (data[5] & 0x3E) >> 1;
                        startPrivateReader();
                }
index 81815ed..fb37b20 100644 (file)
@@ -2,7 +2,6 @@
 #define __epgcache_h_
 
 #define ENABLE_PRIVATE_EPG 1
-#define ENABLE_MHW_EPG 1
 
 #ifndef SWIG
 
@@ -153,7 +152,7 @@ class eEPGCache: public eMainloop, private eThread, public Object
                eEPGCache *cache;
                eTimer abortTimer, zapTimer;
                int prevChannelState;
-               __u8 state, isRunning, haveData, can_delete;
+               __u8 state, isRunning, haveData;
                ePtr<eDVBChannel> channel;
                ePtr<eConnection> m_stateChangedConn, m_NowNextConn, m_ScheduleConn, m_ScheduleOtherConn;
                ePtr<iDVBSectionReader> m_NowNextReader, m_ScheduleReader, m_ScheduleOtherReader;
@@ -168,6 +167,9 @@ class eEPGCache: public eMainloop, private eThread, public Object
                std::set<__u8> seenPrivateSections;
                void readPrivateData(const __u8 *data);
                void startPrivateReader();
+               bool canDelete() { return !isRunning && !m_PrivateConn; }
+#else
+               bool canDelete() { return !isRunning; }
 #endif
                void readData(const __u8 *data);
                void startChannel();