X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/02a4a9200f6adfb42e08526e2f31547cde263fb7..e14e11bdcb89bf3a0c306b4207c2c030d752b5f4:/lib/dvb/epgcache.cpp diff --git a/lib/dvb/epgcache.cpp b/lib/dvb/epgcache.cpp index a744655a..8283fbac 100644 --- a/lib/dvb/epgcache.cpp +++ b/lib/dvb/epgcache.cpp @@ -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); @@ -384,7 +384,7 @@ void eEPGCache::sectionRead(const __u8 *data, int source, channel_data *channel) int duration; time_t TM = parseDVBtime( eit_event->start_time_1, eit_event->start_time_2, eit_event->start_time_3, eit_event->start_time_4, eit_event->start_time_5); - time_t now = time(0)+eDVBLocalTimeHandler::getInstance()->difference(); + time_t now = eDVBLocalTimeHandler::getInstance()->nowTime(); if ( TM != 3599 && TM > -1) channel->haveData |= source; @@ -629,7 +629,7 @@ void eEPGCache::cleanLoop() { eDebug("[EPGC] start cleanloop"); - time_t now = time(0)+eDVBLocalTimeHandler::getInstance()->difference(); + time_t now = eDVBLocalTimeHandler::getInstance()->nowTime(); for (eventCache::iterator DBIt = eventDB.begin(); DBIt != eventDB.end(); DBIt++) { @@ -744,7 +744,7 @@ void eEPGCache::gotMessage( const Message &msg ) data->m_PrivatePid = msg.pid; data->m_PrivateService = msg.service; updateMap::iterator It = channelLastUpdated.find( channel->getChannelID() ); - int update = ( It != channelLastUpdated.end() ? ( UPDATE_INTERVAL - ( (time(0)+eDVBLocalTimeHandler::getInstance()->difference()-It->second) * 1000 ) ) : ZAP_DELAY ); + int update = ( It != channelLastUpdated.end() ? ( UPDATE_INTERVAL - ( (eDVBLocalTimeHandler::getInstance()->nowTime()-It->second) * 1000 ) ) : ZAP_DELAY ); if (update < ZAP_DELAY) update = ZAP_DELAY; data->startPrivateTimer.start(update, 1); @@ -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); @@ -995,7 +995,7 @@ bool eEPGCache::channel_data::finishEPG() { if (!isRunning) // epg ready { - eDebug("[EPGC] stop caching events(%ld)", time(0)+eDVBLocalTimeHandler::getInstance()->difference()); + eDebug("[EPGC] stop caching events(%ld)", eDVBLocalTimeHandler::getInstance()->nowTime()); zapTimer.start(UPDATE_INTERVAL, 1); eDebug("[EPGC] next update in %i min", UPDATE_INTERVAL / 60000); for (int i=0; i < 3; ++i) @@ -1004,11 +1004,7 @@ bool eEPGCache::channel_data::finishEPG() calcedSections[i].clear(); } singleLock l(cache->cache_lock); - cache->channelLastUpdated[channel->getChannelID()] = time(0)+eDVBLocalTimeHandler::getInstance()->difference(); -#ifdef ENABLE_PRIVATE_EPG - if (seenPrivateSections.empty()) -#endif - can_delete=1; + cache->channelLastUpdated[channel->getChannelID()] = eDVBLocalTimeHandler::getInstance()->nowTime(); return true; } return false; @@ -1016,10 +1012,9 @@ bool eEPGCache::channel_data::finishEPG() void eEPGCache::channel_data::startEPG() { - eDebug("[EPGC] start caching events(%ld)", eDVBLocalTimeHandler::getInstance()->difference()+time(0)); + 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; @@ -1100,7 +1091,7 @@ void eEPGCache::channel_data::startChannel() { updateMap::iterator It = cache->channelLastUpdated.find( channel->getChannelID() ); - int update = ( It != cache->channelLastUpdated.end() ? ( UPDATE_INTERVAL - ( (time(0)+eDVBLocalTimeHandler::getInstance()->difference()-It->second) * 1000 ) ) : ZAP_DELAY ); + int update = ( It != cache->channelLastUpdated.end() ? ( UPDATE_INTERVAL - ( (eDVBLocalTimeHandler::getInstance()->nowTime()-It->second) * 1000 ) ) : ZAP_DELAY ); if (update < ZAP_DELAY) update = ZAP_DELAY; @@ -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) @@ -1203,7 +1193,7 @@ void eEPGCache::channel_data::readData( const __u8 *data) break; default: eDebugNoNewLine("unknown");break; } - eDebug(" finished(%ld)", time(0)+eDVBLocalTimeHandler::getInstance()->difference()); + eDebug(" finished(%ld)", eDVBLocalTimeHandler::getInstance()->nowTime()); if ( reader ) reader->stop(); isRunning &= ~source; @@ -1254,7 +1244,7 @@ RESULT eEPGCache::lookupEventTime(const eServiceReference &service, time_t t, co if ( It != eventDB.end() && !It->second.first.empty() ) // entrys cached ? { if (t==-1) - t = time(0)+eDVBLocalTimeHandler::getInstance()->difference(); + t = eDVBLocalTimeHandler::getInstance()->nowTime(); timeMap::iterator i = direction <= 0 ? It->second.second.lower_bound(t) : // find > or equal It->second.second.upper_bound(t); // just > if ( i != It->second.second.end() ) @@ -1605,7 +1595,7 @@ PyObject *eEPGCache::lookupEvent(PyObject *list, PyObject *convertFunc) } PyObject *nowTime = strchr(argstring, 'C') ? - PyLong_FromLong(time(0)+eDVBLocalTimeHandler::getInstance()->difference()) : + PyLong_FromLong(eDVBLocalTimeHandler::getInstance()->nowTime()) : NULL; bool must_get_service_name = strchr(argstring, 'N') ? true : false; @@ -2406,7 +2396,8 @@ void eEPGCache::channel_data::startPrivateReader() mask.mode[3] = 0x3E; } seenPrivateSections.clear(); - m_PrivateReader->connectRead(slot(*this, &eEPGCache::channel_data::readPrivateData), m_PrivateConn); + if (!m_PrivateConn) + m_PrivateReader->connectRead(slot(*this, &eEPGCache::channel_data::readPrivateData), m_PrivateConn); m_PrivateReader->start(mask); } @@ -2418,28 +2409,12 @@ void eEPGCache::channel_data::readPrivateData( const __u8 *data) { if ( seenPrivateSections.find( data[6] ) == seenPrivateSections.end() ) { -#ifdef NEED_DEMUX_WORKAROUND - int version = data[5]; - version = ((version & 0x3E) >> 1); - can_delete = 0; - if ( m_PrevVersion != version ) - { - cache->privateSectionRead(m_PrivateService, data); - seenPrivateSections.insert(data[6]); - } - else - eDebug("ignore"); -#else - can_delete = 0; cache->privateSectionRead(m_PrivateService, data); seenPrivateSections.insert(data[6]); -#endif } if ( seenPrivateSections.size() == (unsigned int)(data[7] + 1) ) { eDebug("[EPGC] private finished"); - if (!isRunning) - can_delete = 1; m_PrevVersion = (data[5] & 0x3E) >> 1; startPrivateReader(); }