Skip to content

Commit

Permalink
Merge branch 'master' of git.opendreambox.org:/git/enigma2
Browse files Browse the repository at this point in the history
  • Loading branch information
tmbinc committed Jun 9, 2009
2 parents 2d44425 + ddd3b54 commit 1d8153e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 10 deletions.
17 changes: 13 additions & 4 deletions lib/base/estring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,9 @@ std::string convertDVBUTF8(const unsigned char *data, int len, int table, int ts
}
break;
}
case 0x11:
eDebug("unsup. Basic Multilingual Plane of ISO/IEC 10646-1 enc.");
case 0x11: // Basic Multilingual Plane of ISO/IEC 10646-1 enc (UTF-16... Unicode)
table = 65;
tsidonid = 0;
++i;
break;
case 0x12:
Expand Down Expand Up @@ -438,8 +439,16 @@ std::string convertDVBUTF8(const unsigned char *data, int len, int table, int ts
unsigned long code=0;
if ( useTwoCharMapping && i+1 < len && (code=doVideoTexSuppl(data[i], data[i+1])) )
i+=2;
if (!code)
code=recode(data[i++], table);
if (!code) {
if (table == 65) { // unicode
if (i+1 < len) {
code=(data[i] << 8) | data[i+1];
i += 2;
}
}
else
code=recode(data[i++], table);
}
if (!code)
continue;
// Unicode->UTF8 encoding
Expand Down
7 changes: 6 additions & 1 deletion lib/dvb/dvbtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/dvb/dvbtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
23 changes: 19 additions & 4 deletions lib/dvb/epgcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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() )
{
Expand Down

0 comments on commit 1d8153e

Please sign in to comment.