diff options
Diffstat (limited to 'eit.c')
-rw-r--r-- | eit.c | 37 |
1 files changed, 15 insertions, 22 deletions
@@ -8,7 +8,7 @@ * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg <marcel.wiesweg@gmx.de>. * - * $Id: eit.c 1.103 2005/03/20 12:33:51 kls Exp $ + * $Id: eit.c 1.107 2005/05/28 11:35:55 kls Exp $ */ #include "eit.h" @@ -48,12 +48,16 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data) SI::EIT::Event SiEitEvent; for (SI::Loop::Iterator it; eventLoop.getNext(SiEitEvent, it); ) { + // Drop bogus events. + if (SiEitEvent.getStartTime() == 0 || SiEitEvent.getDuration() == 0) + continue; Empty = false; + cEvent *newEvent = NULL; cEvent *pEvent = (cEvent *)pSchedule->GetEvent(SiEitEvent.getEventId(), SiEitEvent.getStartTime()); if (!pEvent) { // If we don't have that event yet, we create a new one. // Otherwise we copy the information into the existing event anyway, because the data might have changed. - pEvent = pSchedule->AddEvent(new cEvent(channelID, SiEitEvent.getEventId())); + pEvent = newEvent = new cEvent(SiEitEvent.getEventId()); if (!pEvent) continue; } @@ -91,8 +95,7 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data) SI::ExtendedEventDescriptors *ExtendedEventDescriptors = NULL; SI::ShortEventDescriptor *ShortEventDescriptor = NULL; cLinkChannels *LinkChannels = NULL; - int NumComponents = 0; - SI::ComponentDescriptor *ComponentDescriptors[MAXCOMPONENTS]; + cComponents *Components = NULL; for (SI::Loop::Iterator it2; (d = SiEitEvent.eventDescriptors.getNext(it2)); ) { switch (d->getDescriptorTag()) { case SI::ExtendedEventDescriptorTag: { @@ -193,12 +196,10 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data) uchar Stream = cd->getStreamContent(); uchar Type = cd->getComponentType(); if (1 <= Stream && Stream <= 2 && Type != 0) { - if (NumComponents < MAXCOMPONENTS) { - ComponentDescriptors[NumComponents++] = cd; - d = NULL; // so that it is not deleted - } - else - dsyslog("more than %d component descriptors!", MAXCOMPONENTS); + if (!Components) + Components = new cComponents; + char buffer[256]; + Components->SetComponent(Components->NumComponents(), cd->getStreamContent(), cd->getComponentType(), I18nNormalizeLanguageCode(cd->languageCode), cd->description.getText(buffer, sizeof(buffer))); } } break; @@ -221,18 +222,10 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data) delete ExtendedEventDescriptors; delete ShortEventDescriptor; - if (NumComponents > 0) { - cComponents *Components = new cComponents(NumComponents); - for (int i = 0; i < NumComponents; i++) { - char buffer[256]; - SI::ComponentDescriptor *cd = ComponentDescriptors[i]; - Components->SetComponent(i, cd->getStreamContent(), cd->getComponentType(), I18nNormalizeLanguageCode(cd->languageCode), cd->description.getText(buffer, sizeof(buffer))); - delete cd; - } - pEvent->SetComponents(Components); - } - else - pEvent->SetComponents(NULL); + if (newEvent) + pSchedule->AddEvent(newEvent); + + pEvent->SetComponents(Components); pEvent->FixEpgBugs(); if (LinkChannels) |