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

165 lines
6.0 KiB
C
Raw Permalink Normal View History

/***************************************************************************
eit.h - description
-------------------
begin : Fri Aug 25 2000
copyright : (C) 2000 by Robert Schneider
email : Robert.Schneider@web.de
2001-08-15: Adapted to 'libdtv' by Rolf Hakenes <hakenes@hippomi.de>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
2002-02-23 17:11:19 +01:00
* $Id: eit.h 1.15 2002/02/23 15:30:25 kls Exp $
***************************************************************************/
#ifndef __EIT_H
#define __EIT_H
2000-10-29 13:17:22 +01:00
#include "thread.h"
#include "tools.h"
2002-01-13 16:18:40 +01:00
#define MAXEPGBUGFIXLEVEL 2
2000-10-29 13:17:22 +01:00
class cEventInfo : public cListObject {
friend class cSchedule;
friend class cEIT;
private:
unsigned char uTableID; // Table ID this event came from
2000-10-29 13:17:22 +01:00
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
char *pExtendedDescription; // Extended description of this event
char *pSubtitle; // Subtitle of event
char *pTitle; // Title of event
unsigned short uEventID; // Event ID of this event
long lDuration; // duration of event in seconds
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);
2000-10-29 13:17:22 +01:00
void SetFollowing(bool foll);
void SetPresent(bool pres);
void SetTitle(const char *string);
2000-10-29 13:17:22 +01:00
void SetServiceID(unsigned short servid);
void SetEventID(unsigned short evid);
void SetDuration(long l);
void SetTime(time_t t);
void SetExtendedDescription(const char *string);
void SetSubtitle(const char *string);
2000-10-29 13:17:22 +01:00
cEventInfo(unsigned short serviceid, unsigned short eventid);
public:
2000-10-29 13:17:22 +01:00
~cEventInfo();
const unsigned char GetTableID(void) const;
2000-10-29 13:17:22 +01:00
const char *GetTimeString(void) const;
const char *GetEndTimeString(void) const;
const char *GetDate(void) const;
bool IsFollowing(void) const;
bool IsPresent(void) const;
const char *GetExtendedDescription(void) const;
const char *GetSubtitle(void) const;
const char *GetTitle(void) const;
unsigned short GetEventID(void) const;
long GetDuration(void) const;
time_t GetTime(void) const;
unsigned short GetServiceID(void) const;
int GetChannelNumber(void) const { return nChannelNumber; }
void SetChannelNumber(int ChannelNumber) const { ((cEventInfo *)this)->nChannelNumber = ChannelNumber; } // doesn't modify the EIT data, so it's ok to make it 'const'
void Dump(FILE *f, const char *Prefix = "") const;
2002-02-23 17:11:19 +01:00
static bool Read(FILE *f, cSchedule *Schedule);
2001-08-17 13:19:10 +02:00
void FixEpgBugs(void);
2000-10-29 13:17:22 +01:00
};
class cSchedule : public cListObject {
friend class cSchedules;
friend class cEIT;
private:
cEventInfo *pPresent;
cEventInfo *pFollowing;
unsigned short uServiceID;
cList<cEventInfo> Events;
protected:
void SetServiceID(unsigned short servid);
bool SetFollowingEvent(cEventInfo *pEvent);
bool SetPresentEvent(cEventInfo *pEvent);
void Cleanup(time_t tTime);
void Cleanup(void);
cSchedule(unsigned short servid = 0);
public:
2000-10-29 13:17:22 +01:00
~cSchedule();
2002-02-23 17:11:19 +01:00
cEventInfo *AddEvent(cEventInfo *EventInfo);
2000-10-29 13:17:22 +01:00
const cEventInfo *GetPresentEvent(void) const;
const cEventInfo *GetFollowingEvent(void) const;
unsigned short GetServiceID(void) const;
const cEventInfo *GetEvent(unsigned short uEventID, time_t tTime = 0) const;
const cEventInfo *GetEventAround(time_t tTime) const;
2000-10-29 13:17:22 +01:00
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;
2002-02-23 17:11:19 +01:00
static bool Read(FILE *f, cSchedules *Schedules);
2000-10-29 13:17:22 +01:00
};
2000-10-29 13:17:22 +01:00
class cSchedules : public cList<cSchedule> {
2002-02-23 17:11:19 +01:00
friend class cSchedule;
2000-10-29 13:17:22 +01:00
friend class cSIProcessor;
private:
const cSchedule *pCurrentSchedule;
unsigned short uCurrentServiceID;
protected:
2002-02-23 17:11:19 +01:00
const cSchedule *SetCurrentServiceID(unsigned short servid);
2000-10-29 13:17:22 +01:00
void Cleanup();
public:
2000-10-29 13:17:22 +01:00
cSchedules(void);
~cSchedules();
const cSchedule *GetSchedule(unsigned short servid) const;
const cSchedule *GetSchedule(void) const;
void Dump(FILE *f, const char *Prefix = "") const;
2002-02-23 17:11:19 +01:00
static bool Read(FILE *f);
2000-10-29 13:17:22 +01:00
};
2000-10-29 13:17:22 +01:00
typedef struct sip_filter {
2000-10-29 13:17:22 +01:00
u_char pid;
u_char tid;
int handle;
bool inuse;
2000-10-29 13:17:22 +01:00
}SIP_FILTER;
2000-10-29 13:17:22 +01:00
class cSIProcessor : public cThread {
private:
static int numSIProcessors;
static cSchedules *schedules;
static cMutex schedulesMutex;
2001-08-11 09:38:12 +02:00
static const char *epgDataFileName;
bool masterSIProcessor;
2000-10-29 13:17:22 +01:00
bool useTStime;
SIP_FILTER *filters;
char *fileName;
bool active;
2000-10-29 13:17:22 +01:00
void Action(void);
bool AddFilter(u_char pid, u_char tid);
bool ShutDownFilters(void);
public:
2000-10-29 13:17:22 +01:00
cSIProcessor(const char *FileName);
~cSIProcessor();
2001-08-11 09:38:12 +02:00
static void SetEpgDataFileName(const char *FileName);
static const char *GetEpgDataFileName(void);
static const cSchedules *Schedules(cMutexLock &MutexLock);
// Caller must provide a cMutexLock which has to survive the entire
// time the returned cSchedules is accessed. Once the cSchedules is no
// longer used, the cMutexLock must be destroyed.
2002-02-23 17:11:19 +01:00
static bool Read(FILE *f = NULL);
void SetStatus(bool On);
2000-10-29 13:17:22 +01:00
bool SetUseTSTime(bool use);
bool SetCurrentServiceID(unsigned short servid);
};
#endif