epgcache.h/cpp: add viasat (sirus 5°E) EPG
authorghost <andreas.monzner@multimedia-labs.de>
Tue, 12 May 2009 10:52:58 +0000 (12:52 +0200)
committerghost <andreas.monzner@multimedia-labs.de>
Tue, 12 May 2009 10:52:58 +0000 (12:52 +0200)
lib/dvb/epgcache.cpp
lib/dvb/epgcache.h

index fdcbe0e9faf2cb835db04288f6ae2e0b850ce6fb..7f2b8369c45f815319f800df4998acb8e53e2078 100644 (file)
@@ -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);
        }
index fc42ded545238d6ffb87c57995ed06a93b33f4f6..dfd19482ca252b379e1e03e576e9e6c965489d3e 100644 (file)
@@ -159,9 +159,9 @@ class eEPGCache: public eMainloop, private eThread, public Object
                int prevChannelState;
                __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;
-               tidMap seenSections[3], calcedSections[3];
+               ePtr<eConnection> m_stateChangedConn, m_NowNextConn, m_ScheduleConn, m_ScheduleOtherConn, m_ViasatConn;
+               ePtr<iDVBSectionReader> m_NowNextReader, m_ScheduleReader, m_ScheduleOtherReader, m_ViasatReader;
+               tidMap seenSections[4], calcedSections[4];
 #ifdef ENABLE_PRIVATE_EPG
                ePtr<eTimer> 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
        {