From: leslie Date: Sun, 20 Sep 2009 01:28:41 +0000 (+0800) Subject: add ECM priorities to override.conf X-Git-Tag: upstream/620~159 X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=6a844c29c4c766a9ef15afe9aed19918073eb45d;p=sasc-ng.git add ECM priorities to override.conf --- diff --git a/cam.c b/cam.c index 3a91321..7b31b6e 100644 --- a/cam.c +++ b/cam.c @@ -1313,6 +1313,7 @@ void cEcmHandler::AddEcmPri(cEcmInfo *n) ep->pri=pri; ep->sysIdent=ident; if(n->Cached() && (!ScSetup.LocalPriority || pri!=-15)) ep->pri+=20; + ep->pri=ep->pri*100 + overrides.GetEcmPrio(n->source,n->transponder,n->caId,n->provId); // keep ecmPriList sorted cEcmPri *eppp, *epp=ecmPriList.First(); diff --git a/examples/override.conf.example b/examples/override.conf.example index 73ea030..82f9b53 100644 --- a/examples/override.conf.example +++ b/examples/override.conf.example @@ -51,6 +51,22 @@ ; ignore:{S61.5W-S148W:}1801:0D04:0600 ; ignore:{*}0622:1833 +; +; Define priority chains for ECM processing +; +; The first listed CAID will have the highest priority, then stepping down. If a +; CAID is not listed, the priority will be lower than the last one. +; +; NOTE: priorities based on provider ID are supported for CAID 0100 & 0500 only, +; and are rejected for others. +; +; format: +; ecmprio:{src[-src]:[freq[-freq]]}caid[/provid][:caid[/provid]][...] +; +; examples +; ecmprio:{S19.2E}0100/6a:0622 +; ecmprio:{S28.5E:12973}1833:1702:1801 + ; ; Add entries to the CAT (conditional access table) in case a EMM stream is ; not announced there. diff --git a/override.c b/override.c index ced1cd4..f7f292f 100644 --- a/override.c +++ b/override.c @@ -178,6 +178,7 @@ cString cValidityRange::Print(void) #define OV_EMMTABLE 4 #define OV_TUNNEL 5 #define OV_IGNORE 6 +#define OV_ECMPRIO 7 // -- cOverrideCat ------------------------------------------------------------- @@ -484,6 +485,68 @@ bool cOverrideIgnore::Ignore(int Caid) return false; } +// -- cOverrideEcmPrio --------------------------------------------------------- + +#define OV_MAXPRIOS 16 + +class cOverrideEcmPrio : public cOverride { +private: + int num, caid[OV_MAXPRIOS], prov[OV_MAXPRIOS]; + // + bool UsesProvId(int caid); +public: + cOverrideEcmPrio(void) { type=OV_ECMPRIO; } + virtual bool Parse(char *str); + int GetPrio(int Caid, int Prov); + }; + +bool cOverrideEcmPrio::Parse(char *str) +{ + if((str=Parse2(str))) { + num=0; + int n=-1; + do { + prov[num]=-1; + int l=n+1; + if(sscanf(&str[l],"%x%n/%x%n",&caid[num],&n,&prov[num],&n)<1) { + PRINTF(L_CORE_LOAD,"override: ECMPRIO format error"); + return false; + } + if(prov[num]>=0 && !UsesProvId(caid[num])) { + PRINTF(L_CORE_LOAD,"override: ECMPRIO provider ID not supported for caid %04x",caid[num]); + return false; + } + n+=l; num++; + } while(num=0 ? " %04x/%x":" %04x",caid[i],prov[i]); + LBEND(); + return true; + } + return false; +} + +bool cOverrideEcmPrio::UsesProvId(int caid) +{ + switch(caid>>8) { + case 0x01: + case 0x05: return true; + } + return false; +} + +int cOverrideEcmPrio::GetPrio(int Caid, int Prov) +{ + int pri=0; + for(int i=0; iParse(p)) { delete ov; ov=0; } } return ov; @@ -570,3 +634,13 @@ bool cOverrides::Ignore(int source, int transponder, int caid) ListUnlock(); return res; } + +int cOverrides::GetEcmPrio(int source, int transponder, int caid, int prov) +{ + int pri=0; + ListLock(false); + cOverrideEcmPrio *ovp=dynamic_cast(Find(OV_ECMPRIO,-1,source,transponder)); + if(ovp) pri=ovp->GetPrio(caid,prov); + ListUnlock(); + return pri; +} diff --git a/override.h b/override.h index 42b8216..316f9cb 100644 --- a/override.h +++ b/override.h @@ -92,6 +92,7 @@ public: void UpdateEcm(cEcmInfo *ecm, bool log); bool AddEmmPids(int caid, int source, int transponder, cPids *pids, int pid); bool Ignore(int source, int transponder, int caid); + int GetEcmPrio(int source, int transponder, int caid, int prov); }; extern cOverrides overrides;