git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1477 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
satbaby
2011-05-16 11:14:39 +00:00
parent f9ea5bf74f
commit b9d090e112

View File

@@ -784,7 +784,7 @@ static void addEvent(const SIevent &evt, const unsigned table_id, const time_t z
dprintf("replacing event %016llx:%02x with %04x:%02x '%.40s'\n", si->second->uniqueKey(),
si->second->table_id, evt.eventID, evt.table_id, evt.getName().c_str());
}
else if (already_exists && (evt.table_id == si->second->table_id && evt.version != si->second->version ) )
else if (already_exists && ( evt.table_id == si->second->table_id && evt.version != si->second->version ))
{
//replace event if new version
dprintf("replacing event version old 0x%02x new 0x%02x'\n", si->second->version, evt.version );
@@ -913,29 +913,35 @@ if (slow_addevent)
event_id_t e_key = e->uniqueKey();
t_channel_id e_chid = e->get_channel_id();
time_t start_time = e->times.begin()->startzeit;
bool found = false;
/* experiments have shown that iterating backwards here is much faster */
/* create an event that's surely behind the one to check in the sort order */
SIevent *fptr = new SIevent(evt);
fptr->eventID = 0xFFFF; /* lowest order sort criteria is eventID */
SIeventPtr f(fptr);
/* returns an iterator that's behind 'f' */
MySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey::iterator x =
mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.end();
mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.upper_bound(f);
/* the first decrement of the iterator gives us an event that's a potential
* match *or* from a different channel, then no event for this channel is stored */
while (x != mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.begin())
{
x--;
if ((*x)->get_channel_id() != e_chid)
{
/* sorted by service id first */
if (found)
break;
}
break;
else
{
event_id_t x_key = (*x)->uniqueKey();
found = true;
/* do we need this check? */
if (x_key == e_key)
continue;
if ((*x)->times.begin()->startzeit != start_time)
if ((*x)->times.begin()->startzeit > start_time)
continue;
/* iterating backwards: if the starttime of the stored events
* is earlier than the new one, we'll never find an identical one
* => bail out */
if ((*x)->times.begin()->startzeit < start_time)
break;
/* here we have (*x)->times.begin()->startzeit == start_time */
if ((*x)->table_id < e->table_id)
{
/* if we already have an event with the same start time but a lower