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 cHookManager::Down(void) { Lock(); while(cLogHook *hook=hooks.First()) DelHook(hook); DelAllFilter(); Unlock(); }
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; }
bool cScDevices::Initialize(void) { #if APIVERSNUM >= 10711 return true; #else if(!vdr_nci || !vdr_ud) { PRINTF(L_GEN_ERROR,"Failed to locate VDR symbols. Plugin not operable"); return false; } if(NumDevices()>0) { PRINTF(L_GEN_ERROR,"Number of devices != 0 on init. Put SC plugin first on VDR commandline! Aborting."); return false; } *vdr_nci=0; *vdr_ud=vdr_save_ud; int i, found=0; for(i=0; i<MAXDVBDEVICES; i++) { if(UseDevice(NextCardIndex())) { char name[128]; cScDevices::DvbName(DEV_DVB_FRONTEND,i,0,name,sizeof(name)); if(access(name,F_OK)==0) { PRINTF(L_GEN_DEBUG,"probing %s",name); int f=open(name,O_RDONLY); if(f>=0) { close(f); PRINTF(L_GEN_DEBUG,"capturing device %d",i); devplugins.First()->Probe(i,0,0); found++; } else { if(errno!=ENODEV && errno!=EINVAL) PRINTF(L_GEN_ERROR,"open %s failed: %s",name,strerror(errno)); break; } } else { if(errno!=ENOENT) PRINTF(L_GEN_ERROR,"access %s failed: %s",name,strerror(errno)); break; } } else NextCardIndex(1); } NextCardIndex(MAXDVBDEVICES-i); if(found>0) PRINTF(L_GEN_INFO,"captured %d video device%s",found,found>1 ? "s" : ""); else PRINTF(L_GEN_INFO,"no DVB device captured"); return found>0; #endif }
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(); }