1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Avoiding multiple EPG entries for the same event

This commit is contained in:
Klaus Schmidinger 2001-10-28 13:53:44 +01:00
parent d64416b922
commit fee4982077
4 changed files with 42 additions and 10 deletions

View File

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

37
eit.c
View File

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

9
eit.h
View File

@ -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;

4
menu.c
View File

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