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

Added the 'running status' to the EPG events

This commit is contained in:
Klaus Schmidinger 2004-02-21 12:28:17 +01:00
parent 062935a844
commit e9c6425168
4 changed files with 43 additions and 30 deletions

View File

@ -2652,7 +2652,7 @@ Video Disk Recorder Revision History
actual CAM type as reported by the CAM. The 'ca.conf' file has been stripped
down to the values 0..4.
2004-02-20: Version 1.3.5
2004-02-21: Version 1.3.5
- Fixed reading the EPG preferred language parameter from 'setup.conf'.
- Fixed switching to a visible programme in case the current channel has neither
@ -2675,3 +2675,8 @@ Video Disk Recorder Revision History
channel won't interrupt an ongoing Transfer mode.
- Added subtable ID and TSDT handling to 'libsi' (thanks to Marcel Wiesweg).
- Fixed some Russian OSD texts (thanks to Vyacheslav Dikonov).
- Added the 'running status' to the EPG events. This might lead to a VPS like
function for recording, but unfortunately not all stations handle this flag
correctly - and some (like RTL, for instance) even change the ID of the same
event randomly, making it impossible for a timer to be programmed on a ceartain
event rather than a specific time. Well, let's see where this leads us...

41
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.86 2004/02/08 10:26:54 kls Exp $
* $Id: eit.c 1.87 2004/02/21 12:20:26 kls Exp $
*/
#include "eit.h"
@ -49,12 +49,11 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data)
cEvent *pEvent = (cEvent *)pSchedule->GetEvent(SiEitEvent.getEventId(), SiEitEvent.getStartTime());
if (!pEvent) {
// If we don't have that event ID yet, we create a new one.
// 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()));
if (!pEvent)
continue;
pEvent->SetTableID(Tid);
}
else {
// We have found an existing event, either through its event ID or its start time.
@ -62,19 +61,9 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data)
// not be overwritten.
if (pEvent->TableID() == 0x00)
continue;
// If the new event comes from a table that belongs to an "other TS" and the existing
// one comes from an "actual TS" table, let's skip it.
#define ISACTUALTS(tid) (tid == 0x4E || (tid & 0x50) == 0x50)
if (!ISACTUALTS(Tid) && ISACTUALTS(pEvent->TableID()))
continue;
// If the new event comes from a "schedule" table and the existing one comes from
// a "present/following" table, let's skip it (the p/f table usually contains more
// information, like e.g. a description).
if ((Tid & 0x50) == 0x50 && pEvent->TableID() == 0x4E || (Tid & 0x60) == 0x60 && pEvent->TableID() == 0x4F)
continue;
// If both events come from the same "schedule" table and the new event's table id is larger than the
// existing one's, let's skip it (higher tids mean "farther in the future" and usually have less information).
if (((Tid & 0x50) == 0x50 || (Tid & 0x60) == 0x60) && (pEvent->TableID() & 0xF0) == (Tid & 0xF0) && (Tid > pEvent->TableID()))
// If the new event has a higher table ID, let's skip it.
// The lower the table ID, the more "current" the information.
if (Tid > pEvent->TableID())
continue;
// If the new event comes from the same table and has the same version number
// as the existing one, let's skip it to avoid unnecessary work.
@ -85,9 +74,16 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data)
if (Tid == pEvent->TableID() && pEvent->Version() == getVersionNumber())
continue;
}
pEvent->SetVersion(getVersionNumber());
pEvent->SetTableID(Tid);
// XXX TODO log different (non-zero) event IDs for the same event???
pEvent->SetEventID(SiEitEvent.getEventId()); // unfortunately some stations use different event ids for the same event in different tables :-(
pEvent->SetTableID(Tid);
pEvent->SetVersion(getVersionNumber());
pEvent->SetStartTime(SiEitEvent.getStartTime());
pEvent->SetDuration(SiEitEvent.getDuration());
if (isPresentFollowing()) {
if (SiEitEvent.getRunningStatus() > SI::RunningStatusNotRunning)
pSchedule->SetRunningStatus(pEvent, SiEitEvent.getRunningStatus());
}
int LanguagePreferenceShort = -1;
int LanguagePreferenceExt = -1;
@ -188,17 +184,8 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data)
delete ExtendedEventDescriptors;
delete ShortEventDescriptor;
pEvent->SetStartTime(SiEitEvent.getStartTime());
pEvent->SetDuration(SiEitEvent.getDuration());
pEvent->FixEpgBugs();
if (isPresentFollowing()) {
if (SiEitEvent.getRunningStatus() == SI::RunningStatusPausing || SiEitEvent.getRunningStatus() == SI::RunningStatusRunning)
pSchedule->SetPresentEvent(pEvent);
else if (SiEitEvent.getRunningStatus() == SI::RunningStatusStartsInAFewSeconds)
pSchedule->SetFollowingEvent(pEvent);
}
if (LinkChannels)
channel->SetLinkChannels(LinkChannels);
}

19
epg.c
View File

@ -7,10 +7,11 @@
* 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.5 2004/02/14 11:00:00 kls Exp $
* $Id: epg.c 1.6 2004/02/21 12:21:18 kls Exp $
*/
#include "epg.h"
#include "libsi/si.h"
#include <ctype.h>
#include <time.h>
@ -22,6 +23,7 @@ cEvent::cEvent(tChannelID ChannelID, u_int16_t EventID)
eventID = EventID;
tableID = 0;
version = 0xFF; // actual version numbers are 0..31
runningStatus = 0;
isPresent = isFollowing = false;
title = NULL;
shortText = NULL;
@ -53,6 +55,11 @@ void cEvent::SetVersion(uchar Version)
version = Version;
}
void cEvent::SetRunningStatus(int RunningStatus)
{
runningStatus = RunningStatus;
}
void cEvent::SetIsPresent(bool IsPresent)
{
isPresent = IsPresent;
@ -489,6 +496,16 @@ const cEvent *cSchedule::GetEventAround(time_t Time) const
return pe;
}
void cSchedule::SetRunningStatus(cEvent *Event, int RunningStatus)
{
for (cEvent *p = events.First(); p; p = events.Next(p)) {
if (p == Event)
p->SetRunningStatus(RunningStatus);
else if (RunningStatus >= SI::RunningStatusPausing && p->RunningStatus() > SI::RunningStatusNotRunning)
p->SetRunningStatus(SI::RunningStatusNotRunning);
}
}
bool cSchedule::SetPresentEvent(cEvent *Event)
{
if (present)

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.4 2004/01/09 15:21:05 kls Exp $
* $Id: epg.h 1.5 2004/02/21 12:12:05 kls Exp $
*/
#ifndef __EPG_H
@ -27,6 +27,7 @@ private:
u_int16_t eventID; // Event ID of this event
uchar tableID; // Table ID this event came from
uchar version; // Version number of section this event came from
int runningStatus; // 0=undefined, 1=not running, 2=starts in a few seconds, 3=pausing, 4=running
//XXX present/following obsolete???
bool isPresent; // true if this is the present event running
bool isFollowing; // true if this is the next event on this channel
@ -44,6 +45,7 @@ public:
u_int16_t EventID(void) const { return eventID; }
uchar TableID(void) const { return tableID; }
uchar Version(void) const { return version; }
int RunningStatus(void) const { return runningStatus; }
bool IsPresent(void) const { return isPresent; }
bool IsFollowing(void) const { return isFollowing; }
const char *Title(void) const { return title; }
@ -58,6 +60,7 @@ public:
void SetEventID(u_int16_t EventID);
void SetTableID(uchar TableID);
void SetVersion(uchar Version);
void SetRunningStatus(int RunningStatus);
void SetIsPresent(bool IsPresent);
void SetIsFollowing(bool IsFollowing);
void SetTitle(const char *Title);
@ -82,6 +85,7 @@ private:
public:
cSchedule(tChannelID ChannelID);
tChannelID ChannelID(void) const { return channelID; }
void SetRunningStatus(cEvent *Event, int RunningStatus);
bool SetPresentEvent(cEvent *Event);
bool SetFollowingEvent(cEvent *Event);
void ResetVersions(void);