void cLogger::SetChains(void) { for(cLogChain *chain=chains.First(); chain; chain=chains.Next(chain)) { bool act=false; if(ScSetup.AutoUpdate>1 || prescan==pmActive) act=true; else if(ScSetup.AutoUpdate==1) { for(cEcmInfo *e=active.First(); e; e=active.Next(e)) if((e->emmCaId && chain->caid==e->emmCaId) || chain->caid==e->caId) { act=true; break; } } if(act) StartChain(chain); else StopChain(chain,prescan==pmStop); } }
void cLogChain::Process(int pid, const unsigned char *data) { if(active) { for(cSystem *sys=systems.First(); sys; sys=systems.Next(sys)) sys->ProcessEMM(pid,caid,data); } }
void cScDevices::Shutdown(void) { for(int n=cDevice::NumDevices(); --n>=0;) { cDevice *dev=cDevice::GetDevice(n); for(cScDevicePlugin *dp=devplugins.First(); dp; dp=devplugins.Next(dp)) if(dp->EarlyShutdown(dev)) break; } }
bool cScDeviceProbe::Probe(int Adapter, int Frontend) { uint32_t subid=GetSubsystemId(Adapter,Frontend); PRINTF(L_GEN_DEBUG,"capturing device %d/%d (subsystem ID %08x)",Adapter,Frontend,subid); for(cScDevicePlugin *dp=devplugins.First(); dp; dp=devplugins.Next(dp)) if(dp->Probe(Adapter,Frontend,subid)) return true; return false; }
void cScDevices::Startup(void) { if(ScSetup.ForceTransfer) SetTransferModeForDolbyDigital(2); for(int n=cDevice::NumDevices(); --n>=0;) { cDevice *dev=cDevice::GetDevice(n); for(cScDevicePlugin *dp=devplugins.First(); dp; dp=devplugins.Next(dp)) if(dp->LateInit(dev)) break; } }
bool cHookManager::TriggerHook(int id) { Lock(); for(cLogHook *hook=hooks.First(); hook; hook=hooks.Next(hook)) if(hook->id==id) { hook->delay.Set(CHAIN_HOLD); Unlock(); return true; } Unlock(); return false; }
void cLogger::ProcessCat(unsigned char *data, int len) { for(int i=0; i<len; i+=data[i+1]+2) { if(data[i]==0x09) { int caid=WORD(data,i+2,0xFFFF); cLogChain *chain; for(chain=chains.First(); chain; chain=chains.Next(chain)) if(chain->caid==caid) break; if(chain) chain->Parse(&data[i]); else { chain=new cLogChain(cardNum,softCSA,source,transponder); if(chain->Parse(&data[i])) chains.Add(chain); else delete chain; } } } }
bool cLogChain::Parse(const unsigned char *cat) { if(cat[0]==0x09) { caid=WORD(cat,2,0xFFFF); LBSTARTF(L_CORE_AU); LBPUT("%d: chain caid %04x",cardNum,caid); cSystem *sys; if(systems.Count()>0) { LBPUT(" ++"); for(sys=systems.First(); sys; sys=systems.Next(sys)) sys->ParseCAT(&pids,cat,source,transponder); } else { LBPUT(" ->"); if(!overrides.Ignore(source,transponder,caid)) { int Pri=0; while((sys=cSystems::FindBySysId(caid,!softCSA,Pri))) { Pri=sys->Pri(); if(sys->HasLogger()) { sys->CardNum(cardNum); sys->ParseCAT(&pids,cat,source,transponder); systems.Add(sys); LBPUT(" %s(%d)",sys->Name(),sys->Pri()); } else delete sys; } } } if(systems.Count()==0) LBPUT(" none available"); for(cPid *pid=pids.First(); pid; pid=pids.Next(pid)) LBPUT(" [%04x-%02x/%02x/%02x]",pid->pid,pid->sct,pid->mask,pid->mode); LBEND(); if(systems.Count()>0 && pids.Count()>0) return true; } return false; }
void cLogger::EcmStatus(const cEcmInfo *ecm, bool on) { Lock(); PRINTF(L_CORE_AUEXTRA,"%d: ecm prgid=%d caid=%04x prov=%.4x %s",cardNum,ecm->prgId,ecm->caId,ecm->provId,on ? "active":"inactive"); source=ecm->source; transponder=ecm->transponder; cEcmInfo *e; if(on) { e=new cEcmInfo(ecm); active.Add(e); if(!up) Up(); } else { for(e=active.First(); e; e=active.Next(e)) if(e->Compare(ecm)) { active.Del(e); break; } } if(prescan>=pmWait) prescan=pmStop; SetChains(); prescan=pmNone; Unlock(); }
void cLogger::ClearChains(void) { for(cLogChain *chain=chains.First(); chain; chain=chains.Next(chain)) StopChain(chain,true); chains.Clear(); }