From: leslie Date: Tue, 9 Mar 2010 09:03:50 +0000 (+0800) Subject: device code structural change X-Git-Tag: upstream/620~84 X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=06d43ede9456ae140a27ba01c7e31172dffcfdc5;p=sasc-ng.git device code structural change --- diff --git a/cam.c b/cam.c index e971dfb..3826203 100644 --- a/cam.c +++ b/cam.c @@ -1485,7 +1485,7 @@ void cEcmHandler::ParseCAInfo(int SysId) // -- cCam --------------------------------------------------------------- -cCam::cCam(cScDvbDevice *dev, int CardNum) +cCam::cCam(cScDevice *dev, int CardNum) { device=dev; cardNum=CardNum; source=transponder=-1; liveVpid=liveApid=0; logger=0; hookman=0; @@ -3015,7 +3015,7 @@ uchar *cDeCsaTSBuffer::Get(void) #endif //SASC -// --- cScDvbDeviceProbe ------------------------------------------------------- +// --- cScDeviceProbe ---------------------------------------------------------- #define DEV_DVB_FRONTEND "frontend" #define DEV_DVB_DVR "dvr" @@ -3023,134 +3023,40 @@ uchar *cDeCsaTSBuffer::Get(void) #define DEV_DVB_CA "ca" #if APIVERSNUM >= 10711 -static cScDvbDeviceProbe *scProbe=0; +cScDeviceProbe *cScDeviceProbe::probe=0; -bool cScDvbDeviceProbe::Probe(int Adapter, int Frontend) +void cScDeviceProbe::Install(void) { - PRINTF(L_GEN_DEBUG,"capturing device %d/%d",Adapter,Frontend); - int cafd=open(cString::sprintf("%s%d/%s%d",DEV_DVB_ADAPTER,Adapter,DEV_DVB_CA,Frontend),O_RDWR); - new cScDvbDevice(Adapter,Frontend,cafd); - return true; + if(!probe) probe=new cScDeviceProbe; } -#endif - -// -- cScDvbDevice ------------------------------------------------------------- - -int cScDvbDevice::budget=0; -#ifndef SASC - -#if APIVERSNUM >= 10711 -cScDvbDevice::cScDvbDevice(int Adapter, int Frontend, int cafd) -:cDvbDevice(Adapter,Frontend) -#else -cScDvbDevice::cScDvbDevice(int n, int cafd) -:cDvbDevice(n) -#endif +void cScDeviceProbe::Remove(void) { - decsa=0; tsBuffer=0; cam=0; fullts=false; -#if APIVERSNUM >= 10500 - ciadapter=0; hwciadapter=0; -#else - memset(lrucaid,0,sizeof(lrucaid)); -#endif - fd_ca=cafd; fd_ca2=dup(fd_ca); fd_dvr=-1; - softcsa=(fd_ca<0); -} - -cScDvbDevice::~cScDvbDevice() -{ - DetachAllReceivers(); - Cancel(3); - EarlyShutdown(); - delete decsa; - if(fd_ca>=0) close(fd_ca); -#if APIVERSNUM >= 10500 - if(fd_ca2>=0) close(fd_ca2); -#endif + delete probe; probe=0; } -void cScDvbDevice::EarlyShutdown(void) +bool cScDeviceProbe::Probe(int Adapter, int Frontend) { -#if APIVERSNUM >= 10500 - SetCamSlot(0); - delete ciadapter; ciadapter=0; - delete hwciadapter; hwciadapter=0; -#endif - if(cam) cam->Stop(); - delete cam; cam=0; + PRINTF(L_GEN_DEBUG,"capturing device %d/%d",Adapter,Frontend); + new cScDevice(Adapter,Frontend,cScDevices::DvbOpen(DEV_DVB_CA,Adapter,Frontend,O_RDWR)); + return true; } - -void cScDvbDevice::LateInit(void) -{ - int n=CardIndex(); - if(DeviceNumber()!=n) - PRINTF(L_GEN_ERROR,"CardIndex - DeviceNumber mismatch! Put SC plugin first on VDR commandline!"); - if(softcsa) { - if(HasDecoder()) PRINTF(L_GEN_ERROR,"Card %d is a full-featured card but no ca device found!",n); - } - else if(ForceBudget(n)) { - PRINTF(L_GEN_INFO,"Budget mode forced on card %d",n); - softcsa=true; - } - -#if APIVERSNUM >= 10500 - if(fd_ca2>=0) hwciadapter=cDvbCiAdapter::CreateCiAdapter(this,fd_ca2); - cam=new cCam(this,n); - ciadapter=new cScCiAdapter(this,n,cam); -#else - if(fd_ca2>=0) { - ciHandler=cCiHandler::CreateCiHandler(fd_ca2); - if(!ciHandler) close(fd_ca2); - } - cam=ScSetup.CapCheck(n) ? new cCam(this,n):0; #endif - if(softcsa) { - decsa=new cDeCSA(n); - if(IsPrimaryDevice() && HasDecoder()) { - PRINTF(L_GEN_INFO,"Enabling hybrid full-ts mode on card %d",n); - fullts=true; - } - else PRINTF(L_GEN_INFO,"Using software decryption on card %d",n); - } -} -void cScDvbDevice::Shutdown(void) -{ - for(int n=cDevice::NumDevices(); --n>=0;) { - cScDvbDevice *dev=dynamic_cast(cDevice::GetDevice(n)); - if(dev) dev->EarlyShutdown(); - } -} +// -- cScDevices --------------------------------------------------------------- -void cScDvbDevice::Startup(void) -{ - if(ScSetup.ForceTransfer) - SetTransferModeForDolbyDigital(2); - for(int n=cDevice::NumDevices(); --n>=0;) { - cScDvbDevice *dev=dynamic_cast(cDevice::GetDevice(n)); - if(dev) dev->LateInit(); - } -} - -void cScDvbDevice::SetForceBudget(int n) -{ - if(n>=0 && n= 10711 - scProbe=new cScDvbDeviceProbe; + cScDeviceProbe::Install(); #else /* This is an extremly ugly hack to access VDRs device scan parameters, which are @@ -3172,14 +3078,14 @@ void cScDvbDevice::OnPluginLoad(void) #endif } -void cScDvbDevice::OnPluginUnload(void) +void cScDevices::OnPluginUnload(void) { #if APIVERSNUM >= 10711 - delete scProbe; scProbe=0; + cScDeviceProbe::Remove(); #endif } -bool cScDvbDevice::Initialize(void) +bool cScDevices::Initialize(void) { #if APIVERSNUM >= 10711 return true; @@ -3198,14 +3104,14 @@ bool cScDvbDevice::Initialize(void) for(i=0; i=0) { close(f); PRINTF(L_GEN_DEBUG,"capturing device %d",i); - new cScDvbDevice(i,DvbOpen(DEV_DVB_CA,i,O_RDWR)); + new cScDevice(i,0,cScDevices::DvbOpen(DEV_DVB_CA,i,0,O_RDWR)); found++; } else { @@ -3227,22 +3133,160 @@ bool cScDvbDevice::Initialize(void) #endif } +void cScDevices::Startup(void) +{ + if(ScSetup.ForceTransfer) + SetTransferModeForDolbyDigital(2); + for(int n=cDevice::NumDevices(); --n>=0;) { + cScDevice *dev=dynamic_cast(cDevice::GetDevice(n)); + if(dev) dev->LateInit(); + } +} + +void cScDevices::Shutdown(void) +{ + for(int n=cDevice::NumDevices(); --n>=0;) { + cScDevice *dev=dynamic_cast(cDevice::GetDevice(n)); + if(dev) dev->EarlyShutdown(); + } +} + +void cScDevices::SetForceBudget(int n) +{ + if(n>=0 && n= 10711 +#define DVB_DEV_SPEC adapter,frontend +#else +#define DVB_DEV_SPEC CardIndex(),0 +#endif + +#ifndef SASC + +cScDevice::cScDevice(int Adapter, int Frontend, int cafd) +#if APIVERSNUM >= 10711 +:cDvbDevice(Adapter,Frontend) +#else +:cDvbDevice(Adapter) +#endif +{ + decsa=0; tsBuffer=0; cam=0; fullts=false; +#if APIVERSNUM >= 10500 + ciadapter=0; hwciadapter=0; +#else + memset(lrucaid,0,sizeof(lrucaid)); +#endif + fd_ca=cafd; fd_ca2=dup(fd_ca); fd_dvr=-1; + softcsa=(fd_ca<0); +} + +cScDevice::~cScDevice() +{ + DetachAllReceivers(); + Cancel(3); + EarlyShutdown(); + delete decsa; + if(fd_ca>=0) close(fd_ca); +#if APIVERSNUM >= 10500 + if(fd_ca2>=0) close(fd_ca2); +#endif +} + +void cScDevice::EarlyShutdown(void) +{ +#if APIVERSNUM >= 10500 + SetCamSlot(0); + delete ciadapter; ciadapter=0; + delete hwciadapter; hwciadapter=0; +#endif + if(cam) cam->Stop(); + delete cam; cam=0; +} + +void cScDevice::LateInit(void) +{ + int n=CardIndex(); + if(DeviceNumber()!=n) + PRINTF(L_GEN_ERROR,"CardIndex - DeviceNumber mismatch! Put SC plugin first on VDR commandline!"); + if(softcsa) { + if(HasDecoder()) PRINTF(L_GEN_ERROR,"Card %d is a full-featured card but no ca device found!",n); + } + else if(cScDevices::ForceBudget(n)) { + PRINTF(L_GEN_INFO,"Budget mode forced on card %d",n); + softcsa=true; + } + +#if APIVERSNUM >= 10500 + if(fd_ca2>=0) hwciadapter=cDvbCiAdapter::CreateCiAdapter(this,fd_ca2); + cam=new cCam(this,n); + ciadapter=new cScCiAdapter(this,n,cam); +#else + if(fd_ca2>=0) { + ciHandler=cCiHandler::CreateCiHandler(fd_ca2); + if(!ciHandler) close(fd_ca2); + } + cam=ScSetup.CapCheck(n) ? new cCam(this,n):0; +#endif + if(softcsa) { + decsa=new cDeCSA(n); + if(IsPrimaryDevice() && HasDecoder()) { + PRINTF(L_GEN_INFO,"Enabling hybrid full-ts mode on card %d",n); + fullts=true; + } + else PRINTF(L_GEN_INFO,"Using software decryption on card %d",n); + } +} + #if APIVERSNUM >= 10501 -bool cScDvbDevice::HasCi(void) +bool cScDevice::HasCi(void) { return ciadapter || hwciadapter; } #endif #if APIVERSNUM >= 10500 -bool cScDvbDevice::Ready(void) +bool cScDevice::Ready(void) { return (ciadapter ? ciadapter->Ready():true) && (hwciadapter ? hwciadapter->Ready():true); } #endif -bool cScDvbDevice::SetPid(cPidHandle *Handle, int Type, bool On) +bool cScDevice::SetPid(cPidHandle *Handle, int Type, bool On) { if(cam) cam->SetPid(Type,Handle->pid,On); tsMutex.Lock(); @@ -3251,18 +3295,10 @@ bool cScDvbDevice::SetPid(cPidHandle *Handle, int Type, bool On) return cDvbDevice::SetPid(Handle,Type,On); } -bool cScDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) +bool cScDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) { #if APIVERSNUM < 10500 - lruMutex.Lock(); - int i=FindLRUPrg(Channel->Source(),Channel->Transponder(),Channel->Sid()); - if(i<0) i=MAX_LRU_CAID-1; - if(i>0) memmove(&lrucaid[1],&lrucaid[0],sizeof(struct LruCaid)*i); - for(i=0; i<=MAXCAIDS; i++) if((lrucaid[0].caids[i]=Channel->Ca(i))==0) break; - lrucaid[0].src=Channel->Source(); - lrucaid[0].tr=Channel->Transponder(); - lrucaid[0].prg=Channel->Sid(); - lruMutex.Unlock(); + SetChannelLRU(Channel); #endif if(cam) cam->Tune(Channel); bool ret=cDvbDevice::SetChannelDevice(Channel,LiveView); @@ -3271,7 +3307,7 @@ bool cScDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) } #if APIVERSNUM < 10500 -int cScDvbDevice::ProvidesCa(const cChannel *Channel) const +int cScDevice::ProvidesCa(const cChannel *Channel) const { if(cam && Channel->Ca()>=CA_ENCRYPTED_MIN) { int caid; @@ -3285,12 +3321,12 @@ int cScDvbDevice::ProvidesCa(const cChannel *Channel) const return cDvbDevice::ProvidesCa(Channel); } -bool cScDvbDevice::CiAllowConcurrent(void) const +bool cScDevice::CiAllowConcurrent(void) const { return softcsa || ScSetup.ConcurrentFF>0; } -bool cScDvbDevice::GetPrgCaids(int source, int transponder, int prg, caid_t *c) +bool cScDevice::GetPrgCaids(int source, int transponder, int prg, caid_t *c) { cMutexLock lock(&lruMutex); int i=FindLRUPrg(source,transponder,prg); @@ -3302,14 +3338,27 @@ bool cScDvbDevice::GetPrgCaids(int source, int transponder, int prg, caid_t *c) return false; } -int cScDvbDevice::FindLRUPrg(int source, int transponder, int prg) +int cScDevice::FindLRUPrg(int source, int transponder, int prg) { for(int i=0; iSource(),Channel->Transponder(),Channel->Sid()); + if(i<0) i=MAX_LRU_CAID-1; + if(i>0) memmove(&lrucaid[1],&lrucaid[0],sizeof(struct LruCaid)*i); + for(i=0; i<=MAXCAIDS; i++) if((lrucaid[0].caids[i]=Channel->Ca(i))==0) break; + lrucaid[0].src=Channel->Source(); + lrucaid[0].tr=Channel->Transponder(); + lrucaid[0].prg=Channel->Sid(); + lruMutex.Unlock(); +} + +void cScDevice::CiStartDecrypting(void) { if(cam) { cSimpleList prgList; @@ -3347,7 +3396,7 @@ void cScDvbDevice::CiStartDecrypting(void) } #endif //APIVERSNUM < 10500 -bool cScDvbDevice::ScActive(void) +bool cScDevice::ScActive(void) { #if APIVERSNUM >= 10500 return dynamic_cast(CamSlot())!=0; @@ -3356,14 +3405,10 @@ bool cScDvbDevice::ScActive(void) #endif } -bool cScDvbDevice::OpenDvr(void) +bool cScDevice::OpenDvr(void) { CloseDvr(); -#if APIVERSNUM >= 10711 - fd_dvr=DvbOpen(DEV_DVB_DVR,adapter,frontend,O_RDONLY|O_NONBLOCK,true); -#else - fd_dvr=DvbOpen(DEV_DVB_DVR,CardIndex(),O_RDONLY|O_NONBLOCK,true); -#endif + fd_dvr=cScDevices::DvbOpen(DEV_DVB_DVR,DVB_DEV_SPEC,O_RDONLY|O_NONBLOCK,true); if(fd_dvr>=0) { tsMutex.Lock(); tsBuffer=new cDeCsaTSBuffer(fd_dvr,MEGABYTE(4),CardIndex()+1,decsa,ScActive()); @@ -3372,7 +3417,7 @@ bool cScDvbDevice::OpenDvr(void) return fd_dvr>=0; } -void cScDvbDevice::CloseDvr(void) +void cScDevice::CloseDvr(void) { tsMutex.Lock(); delete tsBuffer; tsBuffer=0; @@ -3380,18 +3425,18 @@ void cScDvbDevice::CloseDvr(void) if(fd_dvr>=0) { close(fd_dvr); fd_dvr=-1; } } -bool cScDvbDevice::GetTSPacket(uchar *&Data) +bool cScDevice::GetTSPacket(uchar *&Data) { if(tsBuffer) { Data=tsBuffer->Get(); return true; } return false; } -bool cScDvbDevice::SoftCSA(bool live) +bool cScDevice::SoftCSA(bool live) { return softcsa && (!fullts || !live); } -void cScDvbDevice::CaidsChanged(void) +void cScDevice::CaidsChanged(void) { #if APIVERSNUM >= 10500 if(ciadapter) ciadapter->CaidsChanged(); @@ -3399,7 +3444,7 @@ void cScDvbDevice::CaidsChanged(void) #endif } -bool cScDvbDevice::SetCaDescr(ca_descr_t *ca_descr, bool initial) +bool cScDevice::SetCaDescr(ca_descr_t *ca_descr, bool initial) { if(!softcsa || (fullts && ca_descr->index==0)) { cMutexLock lock(&cafdMutex); @@ -3409,7 +3454,7 @@ bool cScDvbDevice::SetCaDescr(ca_descr_t *ca_descr, bool initial) return false; } -bool cScDvbDevice::SetCaPid(ca_pid_t *ca_pid) +bool cScDevice::SetCaPid(ca_pid_t *ca_pid) { if(!softcsa || (fullts && ca_pid->index==0)) { cMutexLock lock(&cafdMutex); @@ -3437,7 +3482,7 @@ static void av7110_write(int fd, unsigned int addr, unsigned int val) } #endif -void cScDvbDevice::DumpAV7110(void) +void cScDevice::DumpAV7110(void) { if(LOG(L_CORE_AV7110)) { #define CODEBASE (0x2e000404+0x1ce00) @@ -3498,87 +3543,42 @@ void cScDvbDevice::DumpAV7110(void) #else //SASC -cScDvbDevice::cScDvbDevice(int n, int cafd) +cScDevice::cScDevice(int n, int cafd) :cDvbDevice(n) { softcsa=false; cam=new cCam(this,n); } -cScDvbDevice::~cScDvbDevice() +cScDevice::~cScDevice() { delete cam; } -void cScDvbDevice::Shutdown(void) +void cScDevice::CaidsChanged(void) {} -void cScDvbDevice::Startup(void) -{} - -void cScDvbDevice::SetForceBudget(int n) -{} - -bool cScDvbDevice::ForceBudget(int n) -{ - return true; -} - -void cScDvbDevice::OnPluginLoad(void) -{} - -void cScDvbDevice::OnPluginUnload(void) -{} - -bool cScDvbDevice::Initialize(void) -{ - return true; -} - -void cScDvbDevice::CaidsChanged(void) -{} - -bool cScDvbDevice::SoftCSA(bool live) +bool cScDevice::SoftCSA(bool live) { return softcsa && !live; } -bool cScDvbDevice::SetCaDescr(ca_descr_t *ca_descr, bool initial) +bool cScDevice::SetCaDescr(ca_descr_t *ca_descr, bool initial) { return false; } -bool cScDvbDevice::SetCaPid(ca_pid_t *ca_pid) +bool cScDevice::SetCaPid(ca_pid_t *ca_pid) { return false; } -void cScDvbDevice::DumpAV7110(void) +void cScDevice::DumpAV7110(void) {} #endif //SASC -int cScDvbDevice::FilterHandle(void) -{ -#if APIVERSNUM >= 10711 - return DvbOpen(DEV_DVB_DEMUX,adapter,frontend,O_RDWR|O_NONBLOCK); -#else - return DvbOpen(DEV_DVB_DEMUX,CardIndex(),O_RDWR|O_NONBLOCK); -#endif -} - -#if APIVERSNUM < 10711 -void cScDvbDevice::DvbName(const char *Name, int n, char *buffer, int len) -{ - snprintf(buffer,len,"/dev/dvb/adapter%d/%s%d",n,Name,0); -} - -int cScDvbDevice::DvbOpen(const char *Name, int n, int Mode, bool ReportError) +int cScDevice::FilterHandle(void) { - char FileName[128]; - DvbName(Name,n,FileName,sizeof(FileName)); - int fd=open(FileName,Mode); - if(fd<0 && ReportError) LOG_ERROR_STR(FileName); - return fd; + return cScDevices::DvbOpen(DEV_DVB_DEMUX,DVB_DEV_SPEC,O_RDWR|O_NONBLOCK); } -#endif diff --git a/cam.h b/cam.h index a8cd183..e05cd64 100644 --- a/cam.h +++ b/cam.h @@ -36,7 +36,7 @@ class cLogHook; class cDeCSA; class cDeCsaTSBuffer; class cScCiAdapter; -class cScDvbDevice; +class cScDevice; class cPrg; // ---------------------------------------------------------------- @@ -130,7 +130,7 @@ typedef unsigned short caid_t; class cCam : private cMutex { private: int cardNum; - cScDvbDevice *device; + cScDevice *device; cSimpleList handlerList; cLogger *logger; cHookManager *hookman; @@ -143,7 +143,7 @@ private: int GetFreeIndex(void); void LogStartup(void); public: - cCam(cScDvbDevice *dev, int CardNum); + cCam(cScDevice *dev, int CardNum); virtual ~cCam(); // EcmHandler API void WriteCW(int index, unsigned char *cw, bool force); @@ -171,15 +171,42 @@ void LogStatsDown(void); // ---------------------------------------------------------------- #if APIVERSNUM >= 10711 -class cScDvbDeviceProbe : public cDvbDeviceProbe { +class cScDeviceProbe : public cDvbDeviceProbe { +private: + static cScDeviceProbe *probe; public: virtual bool Probe(int Adapter, int Frontend); + static void Install(void); + static void Remove(void); }; #endif // ---------------------------------------------------------------- -class cScDvbDevice : public cDvbDevice { +class cScDevices : public cDvbDevice { +private: + static int budget; +public: +#if APIVERSNUM >= 10711 // make compiler happy. These are never used! + cScDevices(void):cDvbDevice(0,0) {} +#else + cScDevices(void):cDvbDevice(0) {} +#endif + static void OnPluginLoad(void); + static void OnPluginUnload(void); + static bool Initialize(void); + static void Startup(void); + static void Shutdown(void); + static void SetForceBudget(int n); + static bool ForceBudget(int n); + static void DvbName(const char *Name, int a, int f, char *buffer, int len); + static int DvbOpen(const char *Name, int a, int f, int Mode, bool ReportError=false); + }; + +// ---------------------------------------------------------------- + +class cScDevice : public cDvbDevice { +friend class cScDevices; private: cDeCSA *decsa; cDeCsaTSBuffer *tsBuffer; @@ -193,7 +220,6 @@ private: bool softcsa, fullts; cMutex cafdMutex; cTimeMs lastDump; - static int budget; // #ifndef SASC void LateInit(void); @@ -211,6 +237,7 @@ private: // int FindLRUPrg(int source, int transponder, int prg); bool GetPrgCaids(int source, int transponder, int prg, caid_t *c); + void SetChannelLRU(const cChannel *Channel); #endif protected: #ifndef SASC @@ -226,17 +253,9 @@ protected: virtual void CloseDvr(void); virtual bool GetTSPacket(uchar *&Data); #endif //SASC -#if APIVERSNUM < 10711 - static void DvbName(const char *Name, int n, char *buffer, int len); - static int DvbOpen(const char *Name, int n, int Mode, bool ReportError=false); -#endif public: -#if APIVERSNUM >= 10711 - cScDvbDevice(int Adapter, int Frontend, int cafd); -#else - cScDvbDevice(int n, int cafd); -#endif - ~cScDvbDevice(); + cScDevice(int Adapter, int Frontend, int cafd); + ~cScDevice(); #ifndef SASC #if APIVERSNUM >= 10501 virtual bool HasCi(void); @@ -245,13 +264,6 @@ public: virtual int ProvidesCa(const cChannel *Channel) const; #endif #endif //SASC - static void OnPluginLoad(void); - static void OnPluginUnload(void); - static bool Initialize(void); - static void Startup(void); - static void Shutdown(void); - static void SetForceBudget(int n); - static bool ForceBudget(int n); virtual bool SetCaDescr(ca_descr_t *ca_descr, bool initial); virtual bool SetCaPid(ca_pid_t *ca_pid); int FilterHandle(void); diff --git a/sc.c b/sc.c index 5afb242..1ec9f4a 100644 --- a/sc.c +++ b/sc.c @@ -1018,7 +1018,7 @@ void cSoftCAM::Shutdown(void) char *cSoftCAM::CurrKeyStr(int CardNum, int num) { - cScDvbDevice *dev=dynamic_cast(cDevice::GetDevice(CardNum)); + cScDevice *dev=dynamic_cast(cDevice::GetDevice(CardNum)); char *str=0; if(dev) { if(dev->Cam()) str=dev->Cam()->CurrentKeyStr(num); @@ -1030,7 +1030,7 @@ char *cSoftCAM::CurrKeyStr(int CardNum, int num) bool cSoftCAM::Active(bool log) { for(int n=cDevice::NumDevices(); --n>=0;) { - cScDvbDevice *dev=dynamic_cast(cDevice::GetDevice(n)); + cScDevice *dev=dynamic_cast(cDevice::GetDevice(n)); if(dev && dev->Cam() && dev->Cam()->Active(log)) return true; } return false; @@ -1038,33 +1038,33 @@ bool cSoftCAM::Active(bool log) void cSoftCAM::SetLogStatus(int CardNum, const cEcmInfo *ecm, bool on) { - cScDvbDevice *dev=dynamic_cast(cDevice::GetDevice(CardNum)); + cScDevice *dev=dynamic_cast(cDevice::GetDevice(CardNum)); if(dev && dev->Cam()) dev->Cam()->LogEcmStatus(ecm,on); } void cSoftCAM::AddHook(int CardNum, cLogHook *hook) { - cScDvbDevice *dev=dynamic_cast(cDevice::GetDevice(CardNum)); + cScDevice *dev=dynamic_cast(cDevice::GetDevice(CardNum)); if(dev && dev->Cam()) dev->Cam()->AddHook(hook); } bool cSoftCAM::TriggerHook(int CardNum, int id) { - cScDvbDevice *dev=dynamic_cast(cDevice::GetDevice(CardNum)); + cScDevice *dev=dynamic_cast(cDevice::GetDevice(CardNum)); return dev && dev->Cam() && dev->Cam()->TriggerHook(id); } void cSoftCAM::CaidsChanged(void) { for(int n=cDevice::NumDevices(); --n>=0;) { - cScDvbDevice *dev=dynamic_cast(cDevice::GetDevice(n)); + cScDevice *dev=dynamic_cast(cDevice::GetDevice(n)); if(dev) dev->CaidsChanged(); } } int cSoftCAM::FilterHandle(int CardNum) { - cScDvbDevice *dev=dynamic_cast(cDevice::GetDevice(CardNum)); + cScDevice *dev=dynamic_cast(cDevice::GetDevice(CardNum)); return dev ? dev->FilterHandle() : -1; } @@ -1096,7 +1096,7 @@ void cScHousekeeper::Action(void) if(++c==20) { c=0; for(int n=cDevice::NumDevices(); --n>=0;) { - cScDvbDevice *dev=dynamic_cast(cDevice::GetDevice(n)); + cScDevice *dev=dynamic_cast(cDevice::GetDevice(n)); if(dev && dev->Cam()) dev->Cam()->HouseKeeping(); } } @@ -1277,7 +1277,7 @@ cScPlugin::cScPlugin(void) #else dllSuccess=true; #endif - if(dllSuccess) cScDvbDevice::OnPluginLoad(); + if(dllSuccess) cScDevices::OnPluginLoad(); keeper=0; } @@ -1286,13 +1286,13 @@ cScPlugin::~cScPlugin() delete keeper; delete ScOpts; delete LogOpts; - cScDvbDevice::OnPluginUnload(); + cScDevices::OnPluginUnload(); } bool cScPlugin::Initialize(void) { PRINTF(L_GEN_INFO,"SC version %s initializing (VDR %s)",ScVersion,VDRVERSION); - return dllSuccess && cScDvbDevice::Initialize(); + return dllSuccess && cScDevices::Initialize(); } bool cScPlugin::Start(void) @@ -1320,7 +1320,7 @@ bool cScPlugin::Start(void) cStructLoaders::SetCfgDir(cfgdir); ScSetup.Check(); if(!cSoftCAM::Load(cfgdir)) return false; - cScDvbDevice::Startup(); + cScDevices::Startup(); keeper=new cScHousekeeper; return true; } @@ -1328,7 +1328,7 @@ bool cScPlugin::Start(void) void cScPlugin::Stop(void) { delete keeper; keeper=0; - cScDvbDevice::Shutdown(); + cScDevices::Shutdown(); LogStatsDown(); cSoftCAM::Shutdown(); #if APIVERSNUM < 10507 @@ -1370,7 +1370,7 @@ bool cScPlugin::ProcessArgs(int argc, char *argv[]) while((c=getopt_long(argc,argv,"B:E:",long_options,&option_index))!=-1) { switch (c) { case 'E': externalAU=optarg; break; - case 'B': cScDvbDevice::SetForceBudget(atoi(optarg)); break; + case 'B': cScDevices::SetForceBudget(atoi(optarg)); break; default: return false; } }