Home

Dokumentation

Impressum

Dokumentation VDR
 

Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

channels.h

Go to the documentation of this file.
00001 
00010 #ifndef __CHANNELS_H
00011 #define __CHANNELS_H
00012 
00013 #include "config.h"
00014 #include "sources.h"
00015 #include "tools.h"
00016 
00017 #define ISTRANSPONDER(f1, f2)  (abs((f1) - (f2)) < 4) //XXX
00018 
00019 struct tChannelParameterMap {
00020   int userValue;
00021   int driverValue;
00022   };
00023 
00024 //XXX into cChannel???
00025 int MapToUser(int Value, const tChannelParameterMap *Map);
00026 int MapToDriver(int Value, const tChannelParameterMap *Map);
00027 int UserIndex(int Value, const tChannelParameterMap *Map);
00028 int DriverIndex(int Value, const tChannelParameterMap *Map);
00029 
00030 extern const tChannelParameterMap InversionValues[];
00031 extern const tChannelParameterMap BandwidthValues[];
00032 extern const tChannelParameterMap CoderateValues[];
00033 extern const tChannelParameterMap ModulationValues[];
00034 extern const tChannelParameterMap TransmissionValues[];
00035 extern const tChannelParameterMap GuardValues[];
00036 extern const tChannelParameterMap HierarchyValues[];
00037 
00038 struct tChannelID {
00039 private:
00040   int source;
00041   int nid;
00042   int tid;
00043   int sid;
00044   int rid;
00045 public:
00046   tChannelID(void) { source = nid = tid = sid = rid = 0; }
00047   tChannelID(int Source, int Nid, int Tid, int Sid, int Rid = 0) { source = Source; nid = Nid; tid = Tid; sid = Sid; rid = Rid; }
00048   bool operator== (const tChannelID &arg) const;
00049   bool Valid(void) { return tid && sid; } // nid and rid are optional and source may be 0
00050   tChannelID &ClrRid(void) { rid = 0; return *this; }
00051   static tChannelID FromString(const char *s);
00052   const char *ToString(void);
00053   static const tChannelID InvalidID;
00054   };
00055 
00057 class cChannel : public cListObject {
00058   friend class cMenuEditChannel;
00059 private:
00060   static char *buffer;
00061   static const char *ToText(cChannel *Channel);
00062   enum { MaxChannelName = 32 }; // 31 chars + terminating 0!
00063   int __BeginData__;
00064   char name[MaxChannelName];
00065 
00071   int frequency; // MHz
00072 
00080   int source;
00081 
00085   int srate;
00086 
00091   int vpid;
00092 
00096   int apid1, apid2;
00097   int dpid1, dpid2;
00098 
00102   int tpid;
00103 
00107   int ca;
00108 
00113   int tid;
00114 
00118   int sid;
00119 
00124   int rid;
00125 
00129   int number;    // Sequence number assigned on load
00130   bool groupSep;
00131 
00137   char polarization;
00138 
00142   int nid;
00143   int inversion;
00144 
00148   int bandwidth;
00149   int coderateH;
00150   int coderateL;
00151   int modulation;
00152   int transmission;
00153   int guard;
00154   int hierarchy;
00155   int __EndData__;
00156   const char *ParametersToString(void);
00157   bool StringToParameters(const char *s);
00158 public:
00159   cChannel(void);
00160   cChannel& operator= (const cChannel &Channel);
00161   const char *ToText(void);
00162   bool Parse(const char *s, bool AllowNonUniqueID = false);
00163   bool Save(FILE *f);
00164   const char *Name(void) const { return name; }
00165   int Frequency(void) const { return frequency; }
00166   int Source(void) const { return source; }
00167   int Srate(void) const { return srate; }
00168   int Vpid(void) const { return vpid; }
00169   int Apid1(void) const { return apid1; }
00170   int Apid2(void) const { return apid2; }
00171   int Dpid1(void) const { return dpid1; }
00172   int Dpid2(void) const { return dpid2; }
00173   int Tpid(void) const { return tpid; }
00174   int Ca(void) const { return ca; }
00175   int Sid(void) const { return sid; }
00176   int Number(void) const { return number; }
00177   void SetNumber(int Number) { number = Number; }
00178   bool GroupSep(void) const { return groupSep; }
00179   char Polarization(void) const { return polarization; }
00180   int Inversion(void) const { return inversion; }
00181   int Bandwidth(void) const { return bandwidth; }
00182   int CoderateH(void) const { return coderateH; }
00183   int CoderateL(void) const { return coderateL; }
00184   int Modulation(void) const { return modulation; }
00185   int Transmission(void) const { return transmission; }
00186   int Guard(void) const { return guard; }
00187   int Hierarchy(void) const { return hierarchy; }
00188   bool IsCable(void) { return (source & cSource::st_Mask) == cSource::stCable; }
00189   bool IsSat(void) { return (source & cSource::st_Mask) == cSource::stSat; }
00190   bool IsTerr(void) { return (source & cSource::st_Mask) == cSource::stTerr; }
00191   tChannelID GetChannelID(void) const;
00192   };
00193 
00194 
00196 class cChannels : public cConfig<cChannel> {
00197 protected:
00198   int maxNumber;
00199 public:
00200   cChannels(void) { maxNumber = 0; }
00201   virtual bool Load(const char *FileName, bool AllowComments = false);
00202 
00206   int GetNextGroup(int Idx);   // Get next channel group
00207 
00211   int GetPrevGroup(int Idx);   // Get previous channel group
00212 
00216   int GetNextNormal(int Idx);  // Get next normal channel (not group)
00217 
00221   void ReNumber(void);         // Recalculate 'number' based on channel type
00222   cChannel *GetByNumber(int Number, int SkipGap = 0);
00223   cChannel *GetByServiceID(int Source, unsigned short ServiceID);
00224   cChannel *GetByChannelID(tChannelID ChannelID, bool TryWithoutRid = false);
00225   bool HasUniqueChannelID(cChannel *NewChannel, cChannel *OldChannel = NULL);
00226   bool SwitchTo(int Number);
00227   int MaxNumber(void) { return maxNumber; }
00228   };
00229 
00230 extern cChannels Channels;
00231 
00232 #endif //__CHANNELS_H
00233 

Generated on Wed Feb 5 23:30:07 2003 for VDR by doxygen1.3-rc2