vdr/channels.h
Klaus Schmidinger fe9499ba90 Version 1.1.17
- Added new entries to 'ca.conf'.
- Fixed closing unused PID handles (thanks to Stefan Schluenss for reporting this
  one).
- Added more examples to 'diseqc.conf' (thanks to Oliver Endriss).
- Fixed disabling multiple recordings on a single DVB card (comment out the definition
  of the macros DO_REC_AND_PLAY_ON_PRIMARY_DEVICE and DO_MULTIPLE_RECORDINGS in
  dvbdevice.c).
- Plugins can now have their very own OSD setup in the object they return from
  a call to cPlugin::MainMenuAction(). In order to implement this, the return type
  of cPlugin::MainMenuAction() had to be changed from (cOsdMenu *) to (cOsdObject *).
  So in case you are compiling an existing plugin with this version of VDR and you
  get an error message, simply change cOsdMenu to cOsdObject in the plugin's source
  for the MainMenuAction() function.
  Plugin authors who have so far (ab)used the cControl mechanism to implement their
  own raw OSD should take a look at the new demo plugin 'osddemo'. It implements
  a very primitive game that shows how a plugin can have its own raw OSD. Especially
  look into cLineGame and see how it implements the Show() function. See also
  the chapter on "User interaction" in PLUGINS.html.
- Added three new fields to the lines in 'channels.conf': NID, TID and RID. NID and
  TID are the Network and Transport Stream IDs, respectively. RID is an additional ID
  that can be used to tell apart channels that would otherwise be indistinguishable.
  This is typically the case with radio channels, which may have the same NID, TID
  and SID, but different "radio IDs". This new field is therefore called RID ("radio
  ID"). Currently NID and TID are not yet used by VDR and should always be 0. The
  RID is actually used when building the "unique channel ID", so if you have channels
  in your 'channels.conf' file that cause error messages when loading, you can set
  the RIDs of these channels to different values.
  When reading an old 'channels.conf' these new fields will be automatically
  initialized to 0 and once the file is written back to disk they will be appended
  to the channel definitions.
  Thanks to Régis Bossut for pointing out that with some providers the channels can
  only be distinguished through the RID.
- The "unique channel ID" now contains an optional 5th part (the RID). See man vdr(5).
- Updated 'channels.conf.cable' and made some channels unique using the new RID
  (thanks to Andreas Kool for pointing out the problems).
- Made some channels unique in 'channels.conf.terr' using the new RID.
- Extended the '-l' option to allow logging to LOG_LOCALn (n=0..7) by writing, for
  instance, '-l 3.7' (suggested by Jürgen Schmidt).
- Now deleting stale lock files if they have a time stamp that is outside the window
  'now +/- LOCKFILESTALETIME'. This improves things in cases where the system time
  makes far jumps, so that a lock file might end up with a time stamp that lies
  in the distant future (thanks to Oliver Endriss).
2002-11-24 18:00:00 +01:00

147 lines
4.7 KiB
C++

/*
* channels.h: Channel handling
*
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.h 1.5 2002/11/24 14:27:51 kls Exp $
*/
#ifndef __CHANNELS_H
#define __CHANNELS_H
#include "config.h"
#include "sources.h"
#include "tools.h"
#define ISTRANSPONDER(f1, f2) (abs((f1) - (f2)) < 4) //XXX
struct tChannelParameterMap {
int userValue;
int driverValue;
};
//XXX into cChannel???
int MapToUser(int Value, const tChannelParameterMap *Map);
int MapToDriver(int Value, const tChannelParameterMap *Map);
int UserIndex(int Value, const tChannelParameterMap *Map);
int DriverIndex(int Value, const tChannelParameterMap *Map);
extern const tChannelParameterMap InversionValues[];
extern const tChannelParameterMap BandwidthValues[];
extern const tChannelParameterMap CoderateValues[];
extern const tChannelParameterMap ModulationValues[];
extern const tChannelParameterMap TransmissionValues[];
extern const tChannelParameterMap GuardValues[];
extern const tChannelParameterMap HierarchyValues[];
struct tChannelID {
private:
int source;
int nid;
int tid;
int sid;
int rid;
public:
tChannelID(void) { source = nid = tid = sid = rid = 0; }
tChannelID(int Source, int Nid, int Tid, int Sid, int Rid = 0) { source = Source; nid = Nid; tid = Tid; sid = Sid; rid = Rid; }
bool operator== (const tChannelID &arg) const;
bool Valid(void) { return source && tid && sid; } // nid and rid are optional
tChannelID &ClrRid(void) { rid = 0; return *this; }
static tChannelID FromString(const char *s);
const char *ToString(void);
static const tChannelID InvalidID;
};
class cChannel : public cListObject {
friend class cMenuEditChannel;
private:
static char *buffer;
static const char *ToText(cChannel *Channel);
enum { MaxChannelName = 32 }; // 31 chars + terminating 0!
int __BeginData__;
char name[MaxChannelName];
int frequency; // MHz
int source;
int srate;
int vpid;
int apid1, apid2;
int dpid1, dpid2;
int tpid;
int ca;
int nid;
int tid;
int sid;
int rid;
int number; // Sequence number assigned on load
bool groupSep;
char polarization;
int inversion;
int bandwidth;
int coderateH;
int coderateL;
int modulation;
int transmission;
int guard;
int hierarchy;
int __EndData__;
const char *ParametersToString(void);
bool StringToParameters(const char *s);
public:
cChannel(void);
cChannel& operator= (const cChannel &Channel);
const char *ToText(void);
bool Parse(const char *s, bool AllowNonUniqueID = false);
bool Save(FILE *f);
const char *Name(void) const { return name; }
int Frequency(void) const { return frequency; }
int Source(void) const { return source; }
int Srate(void) const { return srate; }
int Vpid(void) const { return vpid; }
int Apid1(void) const { return apid1; }
int Apid2(void) const { return apid2; }
int Dpid1(void) const { return dpid1; }
int Dpid2(void) const { return dpid2; }
int Tpid(void) const { return tpid; }
int Ca(void) const { return ca; }
int Sid(void) const { return sid; }
int Number(void) const { return number; }
void SetNumber(int Number) { number = Number; }
bool GroupSep(void) const { return groupSep; }
char Polarization(void) const { return polarization; }
int Inversion(void) const { return inversion; }
int Bandwidth(void) const { return bandwidth; }
int CoderateH(void) const { return coderateH; }
int CoderateL(void) const { return coderateL; }
int Modulation(void) const { return modulation; }
int Transmission(void) const { return transmission; }
int Guard(void) const { return guard; }
int Hierarchy(void) const { return hierarchy; }
bool IsCable(void) { return (source & cSource::st_Mask) == cSource::stCable; }
bool IsSat(void) { return (source & cSource::st_Mask) == cSource::stSat; }
bool IsTerr(void) { return (source & cSource::st_Mask) == cSource::stTerr; }
tChannelID GetChannelID(void) const;
};
class cChannels : public cConfig<cChannel> {
protected:
int maxNumber;
public:
cChannels(void) { maxNumber = 0; }
virtual bool Load(const char *FileName, bool AllowComments = false);
int GetNextGroup(int Idx); // Get next channel group
int GetPrevGroup(int Idx); // Get previous channel group
int GetNextNormal(int Idx); // Get next normal channel (not group)
void ReNumber(void); // Recalculate 'number' based on channel type
cChannel *GetByNumber(int Number, int SkipGap = 0);
cChannel *GetByServiceID(int Source, unsigned short ServiceID);
cChannel *GetByChannelID(tChannelID ChannelID, bool TryWithoutRid = false);
bool HasUniqueChannelID(cChannel *NewChannel, cChannel *OldChannel = NULL);
bool SwitchTo(int Number);
int MaxNumber(void) { return maxNumber; }
};
extern cChannels Channels;
#endif //__CHANNELS_H