performance fix
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 11 Aug 2005 14:02:49 +0000 (14:02 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 11 Aug 2005 14:02:49 +0000 (14:02 +0000)
lib/dvb/epgcache.cpp
lib/dvb/epgcache.h

index bc85717..7a1f78d 100644 (file)
@@ -707,11 +707,14 @@ bool eEPGCache::channel_data::finishEPG()
 {
        if (!isRunning)  // epg ready
        {
 {
        if (!isRunning)  // epg ready
        {
-               eDebug("[EPGC] stop caching events");
+               eDebug("[EPGC] stop caching events(%d)", time(0)+eDVBLocalTimeHandler::getInstance()->difference());
                zapTimer.start(UPDATE_INTERVAL, 1);
                eDebug("[EPGC] next update in %i min", UPDATE_INTERVAL / 60000);
                zapTimer.start(UPDATE_INTERVAL, 1);
                eDebug("[EPGC] next update in %i min", UPDATE_INTERVAL / 60000);
-               seenSections.clear();
-               calcedSections.clear();
+               for (int i=0; i < 3; ++i)
+               {
+                       seenSections[i].clear();
+                       calcedSections[i].clear();
+               }
                singleLock l(cache->cache_lock);
                cache->channelLastUpdated[channel->getChannelID()] = time(0)+eDVBLocalTimeHandler::getInstance()->difference();
                can_delete=1;
                singleLock l(cache->cache_lock);
                cache->channelLastUpdated[channel->getChannelID()] = time(0)+eDVBLocalTimeHandler::getInstance()->difference();
                can_delete=1;
@@ -722,12 +725,15 @@ bool eEPGCache::channel_data::finishEPG()
 
 void eEPGCache::channel_data::startEPG()
 {
 
 void eEPGCache::channel_data::startEPG()
 {
-       eDebug("[EPGC] start caching events");
+       eDebug("[EPGC] start caching events(%d)", eDVBLocalTimeHandler::getInstance()->difference()+time(0));
        state=0;
        haveData=0;
        can_delete=0;
        state=0;
        haveData=0;
        can_delete=0;
-       seenSections.clear();
-       calcedSections.clear();
+       for (int i=0; i < 3; ++i)
+       {
+               seenSections[i].clear();
+               calcedSections[i].clear();
+       }
 
        eDVBSectionFilterMask mask;
        memset(&mask, 0, sizeof(mask));
 
        eDVBSectionFilterMask mask;
        memset(&mask, 0, sizeof(mask));
@@ -780,8 +786,11 @@ void eEPGCache::channel_data::abortNonAvail()
                else
                {
                        ++state;
                else
                {
                        ++state;
-                       seenSections.clear();
-                       calcedSections.clear();
+                       for (int i=0; i < 3; ++i)
+                       {
+                               seenSections[i].clear();
+                               calcedSections[i].clear();
+                       }
                        can_delete=1;
                }
        }
                        can_delete=1;
                }
        }
@@ -806,8 +815,11 @@ void eEPGCache::channel_data::startChannel()
 
 void eEPGCache::channel_data::abortEPG()
 {
 
 void eEPGCache::channel_data::abortEPG()
 {
-       seenSections.clear();
-       calcedSections.clear();
+       for (int i=0; i < 3; ++i)
+       {
+               seenSections[i].clear();
+               calcedSections[i].clear();
+       }
        abortTimer.stop();
        zapTimer.stop();
        if (isRunning)
        abortTimer.stop();
        zapTimer.stop();
        if (isRunning)
@@ -841,22 +853,40 @@ void eEPGCache::channel_data::readData( const __u8 *data)
                eDebug("get Null pointer from section reader !!");
        else
        {
                eDebug("get Null pointer from section reader !!");
        else
        {
-               int source = data[0] > 0x5F ? eEPGCache::SCHEDULE_OTHER : data[0] > 0x4F ? eEPGCache::SCHEDULE : eEPGCache::NOWNEXT;
+               int source;
+               int map;
+               iDVBSectionReader *reader=NULL;
+               switch(data[0])
+               {
+                       case 0x4E ... 0x4F:
+                               reader=m_NowNextReader;
+                               source=eEPGCache::NOWNEXT;
+                               map=0;
+                               break;
+                       case 0x50 ... 0x5F:
+                               reader=m_ScheduleReader;
+                               source=eEPGCache::SCHEDULE;
+                               map=1;
+                               break;
+                       case 0x60 ... 0x6F:
+                               reader=m_ScheduleOtherReader;
+                               source=eEPGCache::SCHEDULE_OTHER;
+                               map=2;
+                               break;
+               }
+               tidMap &seenSections = this->seenSections[map];
+               tidMap &calcedSections = this->calcedSections[map];
                if ( state == 1 && calcedSections == seenSections || state > 1 )
                {
                if ( state == 1 && calcedSections == seenSections || state > 1 )
                {
-                       iDVBSectionReader *reader=NULL;
+                       eDebugNoNewLine("[EPGC] ");
                        switch (source)
                        {
                        switch (source)
                        {
-                               case eEPGCache::SCHEDULE_OTHER:
-                                       reader=m_ScheduleOtherReader;
-                                       break;
-                               case eEPGCache::SCHEDULE:
-                                       reader=m_ScheduleReader;
-                                       break;
-                               case eEPGCache::NOWNEXT:
-                                       reader=m_NowNextReader;
-                                       break;
+                               case eEPGCache::NOWNEXT: eDebugNoNewLine("nownext");break;
+                               case eEPGCache::SCHEDULE: eDebugNoNewLine("schedule");break;
+                               case eEPGCache::SCHEDULE_OTHER: eDebugNoNewLine("schedule other");break;
+                               default: eDebugNoNewLine("unknown");break;
                        }
                        }
+                       eDebug(" finished(%d)", time(0)+eDVBLocalTimeHandler::getInstance()->difference());
                        reader->stop();
                        isRunning &= ~source;
                        if (!isRunning)
                        reader->stop();
                        isRunning &= ~source;
                        if (!isRunning)
index 1282cc8..1da612d 100644 (file)
@@ -158,7 +158,7 @@ class eEPGCache: public eMainloop, private eThread, public Object
                ePtr<eDVBChannel> channel;
                ePtr<eConnection> m_stateChangedConn, m_NowNextConn, m_ScheduleConn, m_ScheduleOtherConn;
                ePtr<iDVBSectionReader> m_NowNextReader, m_ScheduleReader, m_ScheduleOtherReader;
                ePtr<eDVBChannel> channel;
                ePtr<eConnection> m_stateChangedConn, m_NowNextConn, m_ScheduleConn, m_ScheduleOtherConn;
                ePtr<iDVBSectionReader> m_NowNextReader, m_ScheduleReader, m_ScheduleOtherReader;
-               tidMap seenSections, calcedSections;
+               tidMap seenSections[3], calcedSections[3];
                void readData(const __u8 *data);
                void startChannel();
                void startEPG();
                void readData(const __u8 *data);
                void startChannel();
                void startEPG();