From a8470e81a33a19bd47b81f6e10d292293cecf779 Mon Sep 17 00:00:00 2001 From: leslie Date: Mon, 22 Aug 2011 18:23:09 +0200 Subject: [PATCH] sasc: (next try) fix functionality --- cam.c | 4 +- contrib/sasc-ng/sc/sasccam.cpp | 76 ++++++++++++++++++++++++---------- contrib/sasc-ng/sc/sasccam.h | 4 +- device.c | 4 ++ device.h | 2 - 5 files changed, 62 insertions(+), 28 deletions(-) diff --git a/cam.c b/cam.c index 2ac3213..6dfd60a 100644 --- a/cam.c +++ b/cam.c @@ -2040,7 +2040,7 @@ cCam::cCam(cDevice *Device, int Adapter, int Frontend, const char *DevId, cScDev { device=Device; devplugin=DevPlugin; adapter=Adapter; frontend=Frontend; devId=DevId; softcsa=SoftCSA; fullts=FullTS; - decsa=0; tcid=0; rebuildcaids=false; + tcid=0; rebuildcaids=false; memset(version,0,sizeof(version)); #ifndef SASC memset(slots,0,sizeof(slots)); @@ -2055,7 +2055,7 @@ cCam::cCam(cDevice *Device, int Adapter, int Frontend, const char *DevId, cScDev } else PRINTF(L_GEN_ERROR,"failed to create ringbuffer for SC-CI adapter %s.",devId); - if(softcsa) decsa=new cDeCSA(devId); + decsa=softcsa ? new cDeCSA(devId) : 0; #endif //!SASC source=transponder=-1; liveVpid=liveApid=0; logger=0; hookman=0; diff --git a/contrib/sasc-ng/sc/sasccam.cpp b/contrib/sasc-ng/sc/sasccam.cpp index 4d04258..277176b 100644 --- a/contrib/sasc-ng/sc/sasccam.cpp +++ b/contrib/sasc-ng/sc/sasccam.cpp @@ -29,47 +29,80 @@ #include "sasccam.h" #include "scsetup.h" -// -- cScDevice ------------------------------------------------------------- +// -- cScSascDevice ------------------------------------------------------------ -#define SCDEVICE cScDevice +#define SCDEVICE cScSascDevice #define DVBDEVICE cDvbDevice +#define OWN_SETCA #include "device-tmpl.c" #undef SCDEVICE #undef DVBDEVICE +#undef OWN_SETCA -// -- cSascDvbDevice ------------------------------------------------------------- +extern void _SetCaDescr(int adapter, ca_descr_t *ca_descr); +extern void _SetCaPid(int adapter, ca_pid_t *ca_pid); -class cSascDvbDevice : public cScDevice { -private: - int cardidx; +bool cScSascDevice::SetCaDescr(ca_descr_t *ca_descr, bool initial) +{ + printf("Called cScSascDevice::SetCaDescr\n"); + _SetCaDescr(cardIndex,ca_descr); + return true; +} + +bool cScSascDevice::SetCaPid(ca_pid_t *ca_pid) +{ + printf("Called cScSascDevice::SetCaPid\n"); + _SetCaPid(cardIndex,ca_pid); + return true; +} + +// -- cScSascDevicePlugin ------------------------------------------------------ + +class cScSascDevicePlugin : public cScDevicePlugin { public: - cSascDvbDevice(int n, int cafd) :cScDevice(n, 0, cafd) {cardidx = n;} - ~cSascDvbDevice() {}; - bool SetCaDescr(ca_descr_t *ca_descr, bool initial); - bool SetCaPid(ca_pid_t *ca_pid); + virtual cDevice *Probe(int Adapter, int Frontend, uint32_t SubSystemId); + virtual bool LateInit(cDevice *dev); + virtual bool EarlyShutdown(cDevice *dev); + virtual bool SetCaDescr(cDevice *dev, ca_descr_t *ca_descr, bool initial); + virtual bool SetCaPid(cDevice *dev, ca_pid_t *ca_pid); }; -extern void _SetCaDescr(int adapter, ca_descr_t *ca_descr); -bool cSascDvbDevice::SetCaDescr(ca_descr_t *ca_descr, bool initial) +cDevice *cScSascDevicePlugin::Probe(int Adapter, int Frontend, uint32_t SubSystemId) { - printf("Called cSascDvbDevice::SetCaDescr\n"); - _SetCaDescr(cardidx, ca_descr); - return true; + return 0; } -extern void _SetCaPid(int adapter, ca_pid_t *ca_pid); -bool cSascDvbDevice::SetCaPid(ca_pid_t *ca_pid) +bool cScSascDevicePlugin::LateInit(cDevice *dev) { - printf("Called cSascDvbDevice::SetCaPid\n"); - _SetCaPid(cardidx, ca_pid); - return true; + return false; +} + +bool cScSascDevicePlugin::EarlyShutdown(cDevice *dev) +{ + return false; +} + +bool cScSascDevicePlugin::SetCaDescr(cDevice *dev, ca_descr_t *ca_descr, bool initial) +{ + cScSascDevice *d=dynamic_cast(dev); + if(d) return d->SetCaDescr(ca_descr,initial); + return false; +} + +bool cScSascDevicePlugin::SetCaPid(cDevice *dev, ca_pid_t *ca_pid) +{ + cScSascDevice *d=dynamic_cast(dev); + if(d) return d->SetCaPid(ca_pid); + return false; } +// ----------------------------------------------------------------------------- + //Functions to communicate with the cam from the outside world //Initialize the cam sascCam::sascCam(int devnum) { - dev = new cSascDvbDevice(devnum, -1); + dev = new cScSascDevice(new cScSascDevicePlugin,devnum,0,-1); cam = dev->Cam(); ScSetup.ConcurrentFF=8; } @@ -94,4 +127,3 @@ void sascCam::AddPrg(int sid, int *epid, const unsigned char *pmt, int pmtlen) } cam->AddPrg(prg); } - diff --git a/contrib/sasc-ng/sc/sasccam.h b/contrib/sasc-ng/sc/sasccam.h index f1ce30a..b339485 100644 --- a/contrib/sasc-ng/sc/sasccam.h +++ b/contrib/sasc-ng/sc/sasccam.h @@ -1,10 +1,10 @@ class cCam; -class cSascDvbDevice; +class cScSascDevice; class sascCam { private: cCam *cam; - cSascDvbDevice *dev; + cScSascDevice *dev; public: sascCam(int devNum); void Stop(); diff --git a/device.c b/device.c index 5f217c7..b1cc01f 100644 --- a/device.c +++ b/device.c @@ -121,6 +121,8 @@ uchar *cDeCsaTSBuffer::Get(void) return NULL; } +#endif //!SASC + // --- cScDevicePlugin --------------------------------------------------------- static cSimpleList devplugins; @@ -137,6 +139,8 @@ cScDevicePlugin::~cScDevicePlugin() // -- cScDvbDevice ------------------------------------------------------------- +#ifndef SASC + #define SCDEVICE cScDvbDevice #define DVBDEVICE cDvbDevice #if APIVERSNUM < 10711 diff --git a/device.h b/device.h index 8a339fc..831cbf4 100644 --- a/device.h +++ b/device.h @@ -88,7 +88,6 @@ public: // ---------------------------------------------------------------- -#ifndef SASC class cScDevicePlugin : public cSimpleItem { public: cScDevicePlugin(void); @@ -100,6 +99,5 @@ public: virtual bool SetCaPid(cDevice *dev, ca_pid_t *ca_pid) { return false; } virtual bool DumpAV(cDevice *dev) { return false; } }; -#endif //!SASC #endif // ___DEVICE_H -- 2.39.5