]> www.vanbest.org Git - sasc-ng.git/commitdiff
sasc: (next try) fix functionality
authorleslie <unknown>
Mon, 22 Aug 2011 16:23:09 +0000 (18:23 +0200)
committerleslie <unknown>
Mon, 22 Aug 2011 16:23:09 +0000 (18:23 +0200)
cam.c
contrib/sasc-ng/sc/sasccam.cpp
contrib/sasc-ng/sc/sasccam.h
device.c
device.h

diff --git a/cam.c b/cam.c
index 2ac321346a4ff15eb485c91966931d5e5ee1c17f..6dfd60ad1c06c7db1bb157fec3d1352b7cbc1028 100644 (file)
--- 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;
index 4d04258aa7d89c17b9e9e69579f47e0aeeba0484..277176b8a6ee11269925d4cde660d90789bc7fcb 100644 (file)
 #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<cScSascDevice *>(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<cScSascDevice *>(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);
 }
-    
index f1ce30ad35a9280c896719488c8ef59472f8804f..b339485237718673ccc482301c60e0ae29695558 100644 (file)
@@ -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();
index 5f217c7a11bcf8dc2ffb8acc228877c150fa3b72..b1cc01f06aa7bd20968630b8813ddc4c253ec995 100644 (file)
--- a/device.c
+++ b/device.c
@@ -121,6 +121,8 @@ uchar *cDeCsaTSBuffer::Get(void)
   return NULL;
 }
 
+#endif //!SASC
+
 // --- cScDevicePlugin ---------------------------------------------------------
 
 static cSimpleList<cScDevicePlugin> devplugins;
@@ -137,6 +139,8 @@ cScDevicePlugin::~cScDevicePlugin()
 
 // -- cScDvbDevice -------------------------------------------------------------
 
+#ifndef SASC
+
 #define SCDEVICE cScDvbDevice
 #define DVBDEVICE cDvbDevice
 #if APIVERSNUM < 10711
index 8a339fce6737f4f7ed47a3b793790404c3817840..831cbf4918c592f079cf009820cbee79e9224d4d 100644 (file)
--- 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