Fixed detecting the running status in case an empty EPG event is broadcast

This commit is contained in:
Klaus Schmidinger 2004-03-13 15:01:05 +01:00
parent 1fd16f6629
commit 56b624d209
5 changed files with 38 additions and 11 deletions

View File

@ -950,3 +950,6 @@ St
Marc Hoppe <MarcHoppe@gmx.de>
for fixing handling the current menu item
Michael Pennewiß <M.Pennewiss@ARD-Digital.de>
for pointing out that an empty EPG event means there is currently no running event

View File

@ -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).

7
eit.c
View File

@ -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.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();
}

31
epg.c
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
* $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)

6
epg.h
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
* $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<cEvent> 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);