From 75b6f719972578d2bc553db3f30fa8a86c440df7 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 12 May 2009 12:52:58 +0200 Subject: [PATCH] =?utf8?q?epgcache.h/cpp:=20add=20viasat=20(sirus=205?= =?utf8?q?=C2=B0E)=20EPG?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/dvb/epgcache.cpp | 70 +++++++++++++++++++++++++++++++++++++++----- lib/dvb/epgcache.h | 8 +++-- 2 files changed, 67 insertions(+), 11 deletions(-) diff --git a/lib/dvb/epgcache.cpp b/lib/dvb/epgcache.cpp index fdcbe0e9..7f2b8369 100644 --- a/lib/dvb/epgcache.cpp +++ b/lib/dvb/epgcache.cpp @@ -303,6 +303,13 @@ void eEPGCache::DVBChannelRunning(iDVBChannel *chan) eDebug("[eEPGCache] couldnt initialize schedule other reader!!"); return; } + + res = demux->createSectionReader( this, data.m_ViasatReader ); + if ( res ) + { + eDebug("[eEPGCache] couldnt initialize viasat reader!!"); + return; + } #ifdef ENABLE_PRIVATE_EPG res = demux->createSectionReader( this, data.m_PrivateReader ); if ( res ) @@ -1115,7 +1122,7 @@ bool eEPGCache::channel_data::finishEPG() eDebug("[EPGC] stop caching events(%ld)", ::time(0)); zapTimer->start(UPDATE_INTERVAL, 1); eDebug("[EPGC] next update in %i min", UPDATE_INTERVAL / 60000); - for (int i=0; i < 3; ++i) + for (unsigned int i=0; i < sizeof(seenSections)/sizeof(tidMap); ++i) { seenSections[i].clear(); calcedSections[i].clear(); @@ -1135,7 +1142,7 @@ void eEPGCache::channel_data::startEPG() eDebug("[EPGC] start caching events(%ld)", ::time(0)); state=0; haveData=0; - for (int i=0; i < 3; ++i) + for (unsigned int i=0; i < sizeof(seenSections)/sizeof(tidMap); ++i) { seenSections[i].clear(); calcedSections[i].clear(); @@ -1186,6 +1193,14 @@ void eEPGCache::channel_data::startEPG() m_ScheduleOtherReader->start(mask); isRunning |= SCHEDULE_OTHER; + mask.pid = 0x39; + + mask.data[0] = 0x40; + mask.mask[0] = 0x40; + m_ViasatReader->connectRead(slot(*this, &eEPGCache::channel_data::readDataViasat), m_ViasatConn); + m_ViasatReader->start(mask); + isRunning |= VIASAT; + abortTimer->start(7000,true); } @@ -1209,11 +1224,18 @@ void eEPGCache::channel_data::abortNonAvail() } if ( !(haveData&SCHEDULE_OTHER) && (isRunning&SCHEDULE_OTHER) ) { - eDebug("[EPGC] abort non avail schedule_other reading"); + eDebug("[EPGC] abort non avail schedule other reading"); isRunning &= ~SCHEDULE_OTHER; m_ScheduleOtherReader->stop(); m_ScheduleOtherConn=0; } + if ( !(haveData&VIASAT) && (isRunning&VIASAT) ) + { + eDebug("[EPGC] abort non avail viasat reading"); + isRunning &= ~VIASAT; + m_ViasatReader->stop(); + m_ViasatConn=0; + } #ifdef ENABLE_MHW_EPG if ( !(haveData&MHW) && (isRunning&MHW) ) { @@ -1225,12 +1247,14 @@ void eEPGCache::channel_data::abortNonAvail() m_MHWConn2=0; } #endif - if ( isRunning ) + if ( isRunning & VIASAT ) + abortTimer->start(300000, true); + else if ( isRunning ) abortTimer->start(90000, true); else { ++state; - for (int i=0; i < 3; ++i) + for (unsigned int i=0; i < sizeof(seenSections)/sizeof(tidMap); ++i) { seenSections[i].clear(); calcedSections[i].clear(); @@ -1259,7 +1283,7 @@ void eEPGCache::channel_data::startChannel() void eEPGCache::channel_data::abortEPG() { - for (int i=0; i < 3; ++i) + for (unsigned int i=0; i < sizeof(seenSections)/sizeof(tidMap); ++i) { seenSections[i].clear(); calcedSections[i].clear(); @@ -1287,6 +1311,12 @@ void eEPGCache::channel_data::abortEPG() m_ScheduleOtherReader->stop(); m_ScheduleOtherConn=0; } + if (isRunning & VIASAT) + { + isRunning &= ~VIASAT; + m_ViasatReader->stop(); + m_ViasatConn=0; + } #ifdef ENABLE_MHW_EPG if (isRunning & MHW) { @@ -1307,6 +1337,15 @@ void eEPGCache::channel_data::abortEPG() pthread_mutex_unlock(&channel_active); } + +void eEPGCache::channel_data::readDataViasat( const __u8 *data) +{ + __u8 *d=0; + memcpy(&d, &data, sizeof(__u8*)); + d[0] |= 0x80; + readData(data); +} + void eEPGCache::channel_data::readData( const __u8 *data) { int source; @@ -1329,6 +1368,17 @@ void eEPGCache::channel_data::readData( const __u8 *data) source=SCHEDULE_OTHER; map=2; break; + case 0xD0 ... 0xDF: + case 0xE0 ... 0xEF: + { + __u8 *d=0; + memcpy(&d, &data, sizeof(__u8*)); + d[0] &= ~0x80; + reader=m_ViasatReader; + source=VIASAT; + map=3; + break; + } default: eDebug("[EPGC] unknown table_id !!!"); return; @@ -1352,6 +1402,10 @@ void eEPGCache::channel_data::readData( const __u8 *data) m_ScheduleOtherConn=0; eDebugNoNewLine("schedule other"); break; + case VIASAT: + m_ViasatConn=0; + eDebugNoNewLine("viasat"); + break; default: eDebugNoNewLine("unknown");break; } eDebug(" finished(%ld)", ::time(0)); @@ -2983,7 +3037,7 @@ void eEPGCache::channel_data::readMHWData(const __u8 *data) if ( state > 1 || // aborted // have si data.. so we dont read mhw data - (haveData & (SCHEDULE|SCHEDULE_OTHER)) ) + (haveData & (SCHEDULE|SCHEDULE_OTHER|VIASAT)) ) { eDebug("[EPGC] mhw aborted %d", state); } @@ -3149,7 +3203,7 @@ void eEPGCache::channel_data::readMHWData2(const __u8 *data) if ( state > 1 || // aborted // have si data.. so we dont read mhw data - (haveData & (eEPGCache::SCHEDULE|eEPGCache::SCHEDULE_OTHER)) ) + (haveData & (SCHEDULE|SCHEDULE_OTHER|VIASAT)) ) { eDebug("[EPGC] mhw2 aborted %d", state); } diff --git a/lib/dvb/epgcache.h b/lib/dvb/epgcache.h index fc42ded5..dfd19482 100644 --- a/lib/dvb/epgcache.h +++ b/lib/dvb/epgcache.h @@ -159,9 +159,9 @@ class eEPGCache: public eMainloop, private eThread, public Object int prevChannelState; __u8 state, isRunning, haveData; ePtr channel; - ePtr m_stateChangedConn, m_NowNextConn, m_ScheduleConn, m_ScheduleOtherConn; - ePtr m_NowNextReader, m_ScheduleReader, m_ScheduleOtherReader; - tidMap seenSections[3], calcedSections[3]; + ePtr m_stateChangedConn, m_NowNextConn, m_ScheduleConn, m_ScheduleOtherConn, m_ViasatConn; + ePtr m_NowNextReader, m_ScheduleReader, m_ScheduleOtherReader, m_ViasatReader; + tidMap seenSections[4], calcedSections[4]; #ifdef ENABLE_PRIVATE_EPG ePtr startPrivateTimer; int m_PrevVersion; @@ -198,6 +198,7 @@ class eEPGCache: public eMainloop, private eThread, public Object void storeTitle(std::map<__u32, mhw_title_t>::iterator itTitle, std::string sumText, const __u8 *data); #endif void readData(const __u8 *data); + void readDataViasat(const __u8 *data); void startChannel(); void startEPG(); bool finishEPG(); @@ -210,6 +211,7 @@ public: #ifdef ENABLE_MHW_EPG ,MHW=8 #endif + ,VIASAT=16 }; struct Message { -- 2.30.2