prepare for dvb subtitle support (not finished yet)
[enigma2.git] / lib / dvb / epgcache.cpp
index ebf9e2ea5af39fe2ca59cdb50338e11820439d04..4f365e78aef3c172243d34da844755a8d023d4ee 100644 (file)
@@ -766,7 +766,10 @@ void eEPGCache::gotMessage( const Message &msg )
                                        data->m_PrevVersion = -1;
                                        data->m_PrivatePid = msg.pid;
                                        data->m_PrivateService = msg.service;
-                                       updateMap::iterator It = channelLastUpdated.find( channel->getChannelID() );
+                                       int onid = chid.original_network_id.get();
+                                       onid |= 0x80000000;  // we use highest bit as private epg indicator
+                                       chid.original_network_id = onid;
+                                       updateMap::iterator It = channelLastUpdated.find( chid );
                                        int update = ( It != channelLastUpdated.end() ? ( UPDATE_INTERVAL - ( (eDVBLocalTimeHandler::getInstance()->nowTime()-It->second) * 1000 ) ) : ZAP_DELAY );
                                        if (update < ZAP_DELAY)
                                                update = ZAP_DELAY;
@@ -2123,7 +2126,8 @@ PyObject *eEPGCache::search(PyObject *arg)
                        // check all events
                        for (timeMap::iterator evit(evmap.begin()); evit != evmap.end() && maxcount; ++evit)
                        {
-                               if (evit->second->getEventID() == eventid)
+                               int evid = evit->second->getEventID();
+                               if ( evid == eventid)
                                        continue;
                                __u8 *data = evit->second->EITdata;
                                int tmp = evit->second->ByteSize-12;
@@ -2152,7 +2156,7 @@ PyObject *eEPGCache::search(PyObject *arg)
                                                ePtr<eServiceEvent> ptr;
                                                if (needServiceEvent)
                                                {
-                                                       lookupEventId(ref, evit->first, ptr);
+                                                       lookupEventId(ref, evid, ptr);
                                                        if (!ptr)
                                                                eDebug("event not found !!!!!!!!!!!");
                                                }
@@ -2369,13 +2373,21 @@ void eEPGCache::privateSectionRead(const uniqueEPGKey &current_service, const __
                        int sid = data[ptr++] << 8;
                        sid |= data[ptr++];
 
-// WORKAROUND for wrong transmitted epg data
-                       if ( onid == 0x85 && tsid == 0x11 && sid == 0xd3 )  // premiere sends wrong tsid here
-                               tsid = 0x1;
-                       else if ( onid == 0x85 && tsid == 0x3 && sid == 0xf5 ) // premiere sends wrong sid here
-                               sid = 0xdc;
+// WORKAROUND for wrong transmitted epg data (01.08.2006)
+                       if ( onid == 0x85 )
+                       {
+                               switch( (tsid << 16) | sid )
+                               {
+                                       case 0x01030b: sid = 0x1b; tsid = 4; break;  // Premiere Win
+                                       case 0x0300f0: sid = 0xe0; tsid = 2; break;
+                                       case 0x0300f1: sid = 0xe1; tsid = 2; break;
+                                       case 0x0300f5: sid = 0xdc; break;
+                                       case 0x0400d2: sid = 0xe2; tsid = 0x11; break;
+                                       case 0x1100d3: sid = 0xe3; break;
+                               }
+                       }
 ////////////////////////////////////////////
-                               
+
                        uniqueEPGKey service( sid, onid, tsid );
                        descr_len -= 6;
                        while( descr_len > 0 )
@@ -2488,6 +2500,11 @@ void eEPGCache::channel_data::readPrivateData( const __u8 *data)
        if ( seenPrivateSections.size() == (unsigned int)(data[7] + 1) )
        {
                eDebug("[EPGC] private finished");
+               eDVBChannelID chid = channel->getChannelID();
+               int tmp = chid.original_network_id.get();
+               tmp |= 0x80000000; // we use highest bit as private epg indicator
+               chid.original_network_id = tmp;
+               cache->channelLastUpdated[chid] = eDVBLocalTimeHandler::getInstance()->nowTime();
                m_PrevVersion = (data[5] & 0x3E) >> 1;
                startPrivateReader();
        }
@@ -3206,7 +3223,7 @@ start_summary:
                }
        }
 abort:
-       isRunning &= ~eEPGCache::MHW;
+       isRunning &= ~MHW;
        m_MHWConn2=0;
        if ( m_MHWReader2 )
                m_MHWReader2->stop();