Merge branch 'master' of git.opendreambox.org:/git/enigma2
authorghost <andreas.monzner@multimedia-labs.de>
Mon, 8 Jun 2009 20:56:25 +0000 (22:56 +0200)
committerghost <andreas.monzner@multimedia-labs.de>
Mon, 8 Jun 2009 20:56:25 +0000 (22:56 +0200)
lib/dvb/dvbtime.cpp
lib/dvb/dvbtime.h
lib/dvb/epgcache.cpp

index a6830dc..bb6b94b 100644 (file)
@@ -67,7 +67,7 @@ time_t getRTC()
        return rtc_time != prev_time ? rtc_time : 0;
 }
 
-time_t parseDVBtime(__u8 t1, __u8 t2, __u8 t3, __u8 t4, __u8 t5)
+time_t parseDVBtime(__u8 t1, __u8 t2, __u8 t3, __u8 t4, __u8 t5, __u16 *hash)
 {
        tm t;
        t.tm_sec=fromBCD(t5);
@@ -87,6 +87,11 @@ time_t parseDVBtime(__u8 t1, __u8 t2, __u8 t3, __u8 t4, __u8 t5)
        t.tm_isdst =  0;
        t.tm_gmtoff = 0;
 
+       if (hash) {
+               *hash = t.tm_hour * 60 + t.tm_min;
+               *hash |= t.tm_mday << 11;
+       }
+
        return timegm(&t);
 }
 
index 3afff75..c49e67e 100644 (file)
@@ -25,7 +25,7 @@ inline int toBCD(int dec)
        return int(dec/10)*0x10 + dec%10;
 }
 
-time_t parseDVBtime(__u8 t1, __u8 t2, __u8 t3, __u8 t4, __u8 t5);
+time_t parseDVBtime(__u8 t1, __u8 t2, __u8 t3, __u8 t4, __u8 t5, __u16 *hash=0);
 
 class TDT: public eGTable
 {
index 5069e8c..9abd554 100644 (file)
@@ -479,7 +479,12 @@ void eEPGCache::sectionRead(const __u8 *data, int source, channel_data *channel)
        int eit_event_size;
        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 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);
 
        if ( TM != 3599 && TM > -1)
@@ -494,6 +499,7 @@ void eEPGCache::sectionRead(const __u8 *data, int source, channel_data *channel)
 
        while (ptr<len)
        {
+               __u16 event_hash;
                eit_event_size = HILO(eit_event->descriptors_loop_length)+EIT_LOOP_SIZE;
 
                duration = fromBCD(eit_event->duration_1)*3600+fromBCD(eit_event->duration_2)*60+fromBCD(eit_event->duration_3);
@@ -502,7 +508,8 @@ void eEPGCache::sectionRead(const __u8 *data, int source, channel_data *channel)
                        eit_event->start_time_2,
                        eit_event->start_time_3,
                        eit_event->start_time_4,
-                       eit_event->start_time_5);
+                       eit_event->start_time_5,
+                       &event_hash);
 
                if ( TM == 3599 )
                        goto next;
@@ -513,16 +520,24 @@ void eEPGCache::sectionRead(const __u8 *data, int source, channel_data *channel)
                if ( now <= (TM+duration) || TM == 3599 /*NVOD Service*/ )  // old events should not be cached
                {
                        __u16 event_id = HILO(eit_event->event_id);
-//                     eDebug("event_id is %d sid is %04x", event_id, service.sid);
-
                        eventData *evt = 0;
                        int ev_erase_count = 0;
                        int tm_erase_count = 0;
 
+                       if (event_id == 0) {
+                               // hack for some polsat services on 13.0E..... but this also replaces other valid event_ids with value 0..
+                               // but we dont care about it...
+                               event_id = event_hash;
+                               eit_event->event_id_hi = event_hash >> 8;
+                               eit_event->event_id_lo = event_hash & 0xFF;
+                       }
+
                        // search in eventmap
                        eventMap::iterator ev_it =
                                servicemap.first.find(event_id);
 
+//                     eDebug("event_id is %d sid is %04x", event_id, service.sid);
+
                        // entry with this event_id is already exist ?
                        if ( ev_it != servicemap.first.end() )
                        {