|
SASC
DVBSoftCAM
|
00001 /* 00002 * Softcam plugin to VDR (C++) 00003 * 00004 * This code is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This code is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html 00018 */ 00019 00020 #ifndef ___OVERRIDE_H 00021 #define ___OVERRIDE_H 00022 00023 #include "data.h" 00024 00025 // ---------------------------------------------------------------- 00026 00027 class cValidityRange { 00028 private: 00029 int fromCaid, toCaid; 00030 int fromSource, toSource; 00031 int fromFreq, toFreq; 00032 bool wildcard; 00033 // 00034 bool ParseCaidRange(const char *str); 00035 bool ParseSourceRange(const char *str); 00036 bool ParseFreqRange(const char *str); 00037 protected: 00038 char *Parse3(char *s); 00039 char *Parse2(char *s, bool wildAllow=false); 00040 cString Print(void); 00041 public: 00042 cValidityRange(void); 00043 bool Match(int caid, int source, int freq) const; 00044 }; 00045 00046 // ---------------------------------------------------------------- 00047 00048 class cRewriter { 00049 private: 00050 unsigned char *mem; 00051 int mlen; 00052 protected: 00053 const char *name; 00054 int id; 00055 // 00056 unsigned char *Alloc(int len); 00057 public: 00058 cRewriter(const char *Name, int Id); 00059 virtual ~cRewriter(); 00060 virtual bool Rewrite(unsigned char *&data, int &len)=0; 00061 int Id(void) const { return id; } 00062 }; 00063 00064 // ---------------------------------------------------------------- 00065 00066 class cRewriters { 00067 public: 00068 static cRewriter *CreateById(int id); 00069 static int GetIdByName(const char *name); 00070 }; 00071 00072 // ---------------------------------------------------------------- 00073 00074 class cOverride : public cStructItem, public cValidityRange { 00075 protected: 00076 int type; 00077 public: 00078 virtual ~cOverride() {} 00079 virtual bool Parse(char *str)=0; 00080 int Type(void) { return type; } 00081 }; 00082 00083 // ---------------------------------------------------------------- 00084 00085 class cOverrides : public cStructList<cOverride> { 00086 private: 00087 bool caidTrigger; 00088 protected: 00089 cOverride *Find(int type, int caid, int source, int transponder, cOverride *ov=0); 00090 virtual cOverride *ParseLine(char *line); 00091 virtual void PreLoad(void); 00092 virtual void PostLoad(void); 00093 public: 00094 cOverrides(void); 00095 int GetCat(int source, int transponder, unsigned char *buff, int len); 00096 void UpdateEcm(cEcmInfo *ecm, bool log); 00097 bool AddEmmPids(int caid, int source, int transponder, cPids *pids, int pid); 00098 bool Ignore(int source, int transponder, int caid); 00099 int GetEcmPrio(int source, int transponder, int caid, int prov); 00100 }; 00101 00102 extern cOverrides overrides; 00103 00104 #endif //___OVERRIDE_H