diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 037d1155..05fcd76b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -950,3 +950,6 @@ St Marc Hoppe for fixing handling the current menu item + +Michael Pennewiß + for pointing out that an empty EPG event means there is currently no running event diff --git a/HISTORY b/HISTORY index ef115a4f..36f95371 100644 --- a/HISTORY +++ b/HISTORY @@ -2736,3 +2736,5 @@ Video Disk Recorder Revision History - Any newline characters in the 'description' of EPG events are now preserved to allow texts to be displayed the way the tv stations have formatted them. This was also necessary to better display itemized texts. +- Fixed detecting the running status in case an empty EPG event is broadcast (thanks + to Michael Pennewiß for pointing this out). diff --git a/eit.c b/eit.c index 177ef310..a4264776 100644 --- a/eit.c +++ b/eit.c @@ -8,7 +8,7 @@ * Robert Schneider and Rolf Hakenes . * Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg . * - * $Id: eit.c 1.92 2004/03/07 11:51:57 kls Exp $ + * $Id: eit.c 1.93 2004/03/13 13:54:20 kls Exp $ */ #include "eit.h" @@ -43,10 +43,12 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data) Schedules->Add(pSchedule); } + bool Empty = true; bool Modified = false; SI::EIT::Event SiEitEvent; for (SI::Loop::Iterator it; eventLoop.hasNext(it); ) { + Empty = false; SiEitEvent = eventLoop.getNext(it); cEvent *pEvent = (cEvent *)pSchedule->GetEvent(SiEitEvent.getEventId(), SiEitEvent.getStartTime()); @@ -212,6 +214,9 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data) } Modified = true; } + if (Empty && Tid == 0x4E && getSectionNumber() == 0) + // ETR 211: an empty entry in section 0 of table 0x4E means there is currently no event running + pSchedule->ClrRunningStatus(channel); if (Modified) pSchedule->Sort(); } diff --git a/epg.c b/epg.c index c93594d5..28d8c1d2 100644 --- a/epg.c +++ b/epg.c @@ -7,7 +7,7 @@ * Original version (as used in VDR before 1.3.0) written by * Robert Schneider and Rolf Hakenes . * - * $Id: epg.c 1.17 2004/03/13 12:41:24 kls Exp $ + * $Id: epg.c 1.18 2004/03/13 15:01:05 kls Exp $ */ #include "epg.h" @@ -61,8 +61,11 @@ void cEvent::SetVersion(uchar Version) version = Version; } -void cEvent::SetRunningStatus(int RunningStatus) +void cEvent::SetRunningStatus(int RunningStatus, cChannel *Channel) { + if (Channel && runningStatus != RunningStatus && (RunningStatus > SI::RunningStatusNotRunning || runningStatus > SI::RunningStatusUndefined)) + if (Channel->Number() <= 30)//XXX maybe log only those that have timers??? + isyslog("channel %d (%s) event %s '%s' status %d", Channel->Number(), Channel->Name(), GetTimeString(), Title(), RunningStatus); runningStatus = RunningStatus; } @@ -471,6 +474,7 @@ void cEvent::FixEpgBugs(void) cSchedule::cSchedule(tChannelID ChannelID) { channelID = ChannelID; + hasRunning = false;; } cEvent *cSchedule::AddEvent(cEvent *Event) @@ -534,15 +538,26 @@ const cEvent *cSchedule::GetEventAround(time_t Time) const void cSchedule::SetRunningStatus(cEvent *Event, int RunningStatus, cChannel *Channel) { for (cEvent *p = events.First(); p; p = events.Next(p)) { - if (p == Event) { - if (Channel && p->RunningStatus() != RunningStatus && (RunningStatus > SI::RunningStatusNotRunning || p->RunningStatus() > SI::RunningStatusUndefined)) - if (Channel->Number() <= 30)//XXX maybe log only those that have timers??? - isyslog("channel %d (%s) event %s '%s' status %d", Channel->Number(), Channel->Name(), Event->GetTimeString(), Event->Title(), RunningStatus); - p->SetRunningStatus(RunningStatus); - } + if (p == Event) + p->SetRunningStatus(RunningStatus, Channel); else if (RunningStatus >= SI::RunningStatusPausing && p->RunningStatus() > SI::RunningStatusNotRunning) p->SetRunningStatus(SI::RunningStatusNotRunning); } + if (RunningStatus >= SI::RunningStatusPausing) + hasRunning = true; +} + +void cSchedule::ClrRunningStatus(cChannel *Channel) +{ + if (hasRunning) { + for (cEvent *p = events.First(); p; p = events.Next(p)) { + if (p->RunningStatus() >= SI::RunningStatusPausing) { + p->SetRunningStatus(SI::RunningStatusNotRunning, Channel); + hasRunning = false; + break; + } + } + } } void cSchedule::ResetVersions(void) diff --git a/epg.h b/epg.h index 88355522..74e5c0bd 100644 --- a/epg.h +++ b/epg.h @@ -7,7 +7,7 @@ * Original version (as used in VDR before 1.3.0) written by * Robert Schneider and Rolf Hakenes . * - * $Id: epg.h 1.13 2004/03/06 14:01:38 kls Exp $ + * $Id: epg.h 1.14 2004/03/13 13:39:13 kls Exp $ */ #ifndef __EPG_H @@ -61,7 +61,7 @@ public: void SetEventID(u_int16_t EventID); void SetTableID(uchar TableID); void SetVersion(uchar Version); - void SetRunningStatus(int RunningStatus); + void SetRunningStatus(int RunningStatus, cChannel *Channel = NULL); void SetTitle(const char *Title); void SetShortText(const char *ShortText); void SetDescription(const char *Description); @@ -79,10 +79,12 @@ class cSchedule : public cListObject { private: tChannelID channelID; cList events; + bool hasRunning; public: cSchedule(tChannelID ChannelID); tChannelID ChannelID(void) const { return channelID; } void SetRunningStatus(cEvent *Event, int RunningStatus, cChannel *Channel = NULL); + void ClrRunningStatus(cChannel *Channel = NULL); void ResetVersions(void); void Sort(void); void Cleanup(time_t Time);