|
SASC
DVBSoftCAM
|
00001 /* 00002 * Softcam plugin to VDR (C++) 00003 * 00004 * This code is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This code is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html 00018 */ 00019 00020 #define SASC 00021 00022 #include <stdlib.h> 00023 #include <stdio.h> 00024 00025 #include "include/vdr/dvbdevice.h" 00026 #include "include/vdr/channels.h" 00027 #include "cam.h" 00028 #include "device.h" 00029 #include "sasccam.h" 00030 #include "scsetup.h" 00031 00032 // -- cScSascDevice ------------------------------------------------------------ 00033 00034 #define SCDEVICE cScSascDevice 00035 #define DVBDEVICE cDvbDevice 00036 #define OWN_SETCA 00037 #include "device-tmpl.c" 00038 00039 extern void _SetCaDescr(int adapter, ca_descr_t *ca_descr); 00040 extern void _SetCaPid(int adapter, ca_pid_t *ca_pid); 00041 00042 bool cScSascDevice::SetCaDescr(ca_descr_t *ca_descr, bool initial) 00043 { 00044 printf("Called cScSascDevice::SetCaDescr\n"); 00045 _SetCaDescr(cardIndex,ca_descr); 00046 return true; 00047 } 00048 00049 bool cScSascDevice::SetCaPid(ca_pid_t *ca_pid) 00050 { 00051 printf("Called cScSascDevice::SetCaPid\n"); 00052 _SetCaPid(cardIndex,ca_pid); 00053 return true; 00054 } 00055 00056 // -- cScSascDevicePlugin ------------------------------------------------------ 00057 00058 class cScSascDevicePlugin : public cScDevicePlugin { 00059 public: 00060 virtual cDevice *Probe(int Adapter, int Frontend, uint32_t SubSystemId); 00061 virtual bool LateInit(cDevice *dev); 00062 virtual bool EarlyShutdown(cDevice *dev); 00063 virtual bool SetCaDescr(cDevice *dev, ca_descr_t *ca_descr, bool initial); 00064 virtual bool SetCaPid(cDevice *dev, ca_pid_t *ca_pid); 00065 }; 00066 00067 cDevice *cScSascDevicePlugin::Probe(int Adapter, int Frontend, uint32_t SubSystemId) 00068 { 00069 return 0; 00070 } 00071 00072 bool cScSascDevicePlugin::LateInit(cDevice *dev) 00073 { 00074 return false; 00075 } 00076 00077 bool cScSascDevicePlugin::EarlyShutdown(cDevice *dev) 00078 { 00079 return false; 00080 } 00081 00082 bool cScSascDevicePlugin::SetCaDescr(cDevice *dev, ca_descr_t *ca_descr, bool initial) 00083 { 00084 cScSascDevice *d=dynamic_cast<cScSascDevice *>(dev); 00085 if(d) return d->SetCaDescr(ca_descr,initial); 00086 return false; 00087 } 00088 00089 bool cScSascDevicePlugin::SetCaPid(cDevice *dev, ca_pid_t *ca_pid) 00090 { 00091 cScSascDevice *d=dynamic_cast<cScSascDevice *>(dev); 00092 if(d) return d->SetCaPid(ca_pid); 00093 return false; 00094 } 00095 00096 // ----------------------------------------------------------------------------- 00097 00098 //Functions to communicate with the cam from the outside world 00099 //Initialize the cam 00100 sascCam::sascCam(int devnum) 00101 { 00102 dev = new cScSascDevice(new cScSascDevicePlugin,devnum,0,-1); 00103 cam = dev->Cam(); 00104 ScSetup.ConcurrentFF=8; 00105 } 00106 void sascCam::Tune(cChannel *ch) 00107 { 00108 cam->Tune(ch); 00109 } 00110 void sascCam::Stop() 00111 { 00112 cam->Stop(); 00113 } 00114 void sascCam::AddPrg(int sid, int *epid, const unsigned char *pmt, int pmtlen) 00115 { 00116 int i = 0; 00117 if(! epid) 00118 return; 00119 cPrg *prg=new cPrg(sid, 1); 00120 if(pmt) prg->caDescr.Set(pmt,pmtlen); 00121 while(epid[i]) { 00122 cPrgPid *pid=new cPrgPid(5, epid[i++]); 00123 prg->pids.Add(pid); 00124 } 00125 cam->AddPrg(prg); 00126 }