summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-10-28 13:53:44 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2001-10-28 13:53:44 +0100
commitfee4982077d5aebadd44afbc2fa3b5f274c93af0 (patch)
tree838d0f48779cb5cd85e22af12f1e2a5f7273ca40
parentd64416b922d54f1a0fda25d00cd51faf14bafcc3 (diff)
downloadvdr-fee4982077d5aebadd44afbc2fa3b5f274c93af0.tar.gz
vdr-fee4982077d5aebadd44afbc2fa3b5f274c93af0.tar.bz2
Avoiding multiple EPG entries for the same event
-rw-r--r--HISTORY2
-rw-r--r--eit.c37
-rw-r--r--eit.h9
-rw-r--r--menu.c4
4 files changed, 42 insertions, 10 deletions
diff --git a/HISTORY b/HISTORY
index ea506570..3e4e34b2 100644
--- a/HISTORY
+++ b/HISTORY
@@ -845,3 +845,5 @@ Video Disk Recorder Revision History
- Changed the tuning code to use FrontendInfo to detect the type of DVB card.
- Removed the recursion stuff from cThread (cMutex already does this).
- Fixed handling the repeat function in the channel display.
+- Avoiding multiple EPG entries for the same event (thanks to Rolf Hakenes
+ for some valuable information on how to do this).
diff --git a/eit.c b/eit.c
index 71ab54c3..00792ab5 100644
--- a/eit.c
+++ b/eit.c
@@ -16,7 +16,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: eit.c 1.28 2001/10/19 13:13:25 kls Exp $
+ * $Id: eit.c 1.29 2001/10/28 13:51:22 kls Exp $
***************************************************************************/
#include "eit.h"
@@ -189,6 +189,7 @@ cEventInfo::cEventInfo(unsigned short serviceid, unsigned short eventid)
bIsPresent = bIsFollowing = false;
lDuration = 0;
tTime = 0;
+ uTableID = 0;
uEventID = eventid;
uServiceID = serviceid;
nChannelNumber = 0;
@@ -231,6 +232,12 @@ bool cEventInfo::IsFollowing() const
{
return bIsFollowing;
}
+
+void cEventInfo::SetTableID(unsigned char tableid)
+{
+ uTableID = tableid;
+}
+
/** */
void cEventInfo::SetFollowing(bool foll)
{
@@ -246,6 +253,12 @@ const char * cEventInfo::GetDate() const
return szDate;
}
+
+const unsigned char cEventInfo::GetTableID(void) const
+{
+ return uTableID;
+}
+
/** */
const char * cEventInfo::GetTimeString() const
{
@@ -545,21 +558,26 @@ unsigned short cSchedule::GetServiceID() const
return uServiceID;
}
/** */
-const cEventInfo * cSchedule::GetEvent(unsigned short uEventID) const
+const cEventInfo * cSchedule::GetEvent(unsigned short uEventID, time_t tTime) const
{
+ // Returns either the event info with the given uEventID or, if that one can't
+ // be found, the one with the given tTime (or NULL if neither can be found)
cEventInfo *pe = Events.First();
+ cEventInfo *pt = NULL;
while (pe != NULL)
{
if (pe->GetEventID() == uEventID)
return pe;
+ if (tTime > 0 && pe->GetTime() == tTime) // 'tTime < 0' is apparently used with NVOD channels
+ pt = pe;
pe = Events.Next(pe);
}
- return NULL;
+ return pt;
}
/** */
-const cEventInfo * cSchedule::GetEvent(time_t tTime) const
+const cEventInfo * cSchedule::GetEventAround(time_t tTime) const
{
cEventInfo *pe = Events.First();
while (pe != NULL)
@@ -759,7 +777,7 @@ int cEIT::ProcessEIT(unsigned char *buffer)
if (!rEvent)
break;
}
- pEvent = (cEventInfo *)pSchedule->GetEvent((unsigned short)VdrProgramInfo->EventID);
+ pEvent = (cEventInfo *)pSchedule->GetEvent((unsigned short)VdrProgramInfo->EventID, VdrProgramInfo->StartTime);
if (!pEvent) {
// If we don't have that event ID yet, we create a new one.
// Otherwise we copy the information into the existing event anyway, because the data might have changed.
@@ -767,6 +785,14 @@ int cEIT::ProcessEIT(unsigned char *buffer)
pEvent = (cEventInfo *)pSchedule->GetEvent((unsigned short)VdrProgramInfo->EventID);
if (!pEvent)
break;
+ pEvent->SetTableID(tid);
+ }
+ else {
+ // We have found an existing event, either through its event ID or its start time.
+ // If the new event comes from a table that belongs to an "other TS" and the existing
+ // one comes from a "actual TS" table, lets skip it.
+ if ((tid == 0x4F || tid == 0x60) && (pEvent->GetTableID() == 0x4E || pEvent->GetTableID() == 0x50))
+ continue;
}
if (rEvent) {
pEvent->SetTitle(rEvent->GetTitle());
@@ -774,6 +800,7 @@ int cEIT::ProcessEIT(unsigned char *buffer)
pEvent->SetExtendedDescription(rEvent->GetExtendedDescription());
}
else {
+ pEvent->SetTableID(tid);
pEvent->SetTitle(VdrProgramInfo->ShortName);
pEvent->SetSubtitle(VdrProgramInfo->ShortText);
pEvent->SetExtendedDescription(VdrProgramInfo->ExtendedName);
diff --git a/eit.h b/eit.h
index 91d5b2b3..13141962 100644
--- a/eit.h
+++ b/eit.h
@@ -16,7 +16,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: eit.h 1.11 2001/09/22 11:43:21 kls Exp $
+ * $Id: eit.h 1.12 2001/10/28 12:33:10 kls Exp $
***************************************************************************/
#ifndef __EIT_H
@@ -29,6 +29,7 @@ class cEventInfo : public cListObject {
friend class cSchedule;
friend class cEIT;
private:
+ unsigned char uTableID; // Table ID this event came from
unsigned short uServiceID; // Service ID of program for that event
bool bIsFollowing; // true if this is the next event on this channel
bool bIsPresent; // true if this is the present event running
@@ -40,6 +41,7 @@ private:
time_t tTime; // Start time
int nChannelNumber; // the actual channel number from VDR's channel list (used in cMenuSchedule for sorting by channel number)
protected:
+ void SetTableID(unsigned char tableid);
void SetFollowing(bool foll);
void SetPresent(bool pres);
void SetTitle(const char *string);
@@ -52,6 +54,7 @@ protected:
cEventInfo(unsigned short serviceid, unsigned short eventid);
public:
~cEventInfo();
+ const unsigned char GetTableID(void) const;
const char *GetTimeString(void) const;
const char *GetEndTimeString(void) const;
const char *GetDate(void) const;
@@ -90,8 +93,8 @@ public:
const cEventInfo *GetPresentEvent(void) const;
const cEventInfo *GetFollowingEvent(void) const;
unsigned short GetServiceID(void) const;
- const cEventInfo *GetEvent(unsigned short uEventID) const;
- const cEventInfo *GetEvent(time_t tTime) const;
+ const cEventInfo *GetEvent(unsigned short uEventID, time_t tTime = 0) const;
+ const cEventInfo *GetEventAround(time_t tTime) const;
const cEventInfo *GetEventNumber(int n) const { return Events.Get(n); }
int NumEvents(void) const { return Events.Count(); }
void Dump(FILE *f, const char *Prefix = "") const;
diff --git a/menu.c b/menu.c
index d05b159d..c99e9f03 100644
--- a/menu.c
+++ b/menu.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: menu.c 1.135 2001/10/28 10:04:50 kls Exp $
+ * $Id: menu.c 1.136 2001/10/28 12:00:16 kls Exp $
*/
#include "menu.h"
@@ -2170,7 +2170,7 @@ bool cRecordControl::GetEventInfo(void)
if (Schedules) {
const cSchedule *Schedule = Schedules->GetSchedule(channel->pnr);
if (Schedule) {
- eventInfo = Schedule->GetEvent(Time);
+ eventInfo = Schedule->GetEventAround(Time);
if (eventInfo) {
if (seconds > 0)
dsyslog(LOG_INFO, "got EPG info after %d seconds", seconds);