|
SASC-NG
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 #include <stdlib.h> 00021 #include <stdio.h> 00022 #include <sys/ioctl.h> 00023 00024 #ifndef SASC 00025 00026 #include <vdr/channels.h> 00027 #include <vdr/ci.h> 00028 #include <vdr/dvbci.h> 00029 00030 #include "device.h" 00031 #include "cam.h" 00032 #include "scsetup.h" 00033 #include "log-core.h" 00034 #include "version.h" 00035 00036 SCAPIVERSTAG(); 00037 00038 #if APIVERSNUM >= 10711 00039 #ifdef WITH_HDDVB 00040 00041 // -- cScDvbHdFfDevice --------------------------------------------------------- 00042 00043 #include "../dvbhddevice/dvbhdffdevice.h" 00044 #define SCDEVICE cScDvbHdFfDevice 00045 #define DVBDEVICE cDvbHdFfDevice 00046 #define OWN_SETCA 00047 #include "device-tmpl.c" 00048 00049 bool cScDvbHdFfDevice::SetCaDescr(ca_descr_t *ca_descr, bool initial) 00050 { 00051 if(!initial) cCondWait::SleepMs(150); 00052 cMutexLock lock(&cafdMutex); 00053 return ioctl(fd_ca,CA_SET_DESCR,ca_descr)>=0; 00054 } 00055 00056 bool cScDvbHdFfDevice::SetCaPid(ca_pid_t *ca_pid) 00057 { 00058 cMutexLock lock(&cafdMutex); 00059 return ioctl(fd_ca,CA_SET_PID,ca_pid)>=0; 00060 } 00061 00062 // -- cScHdDevicePlugin -------------------------------------------------------- 00063 00064 class cScHdDevicePlugin : public cScDevicePlugin { 00065 public: 00066 virtual cDevice *Probe(int Adapter, int Frontend, uint32_t SubSystemId); 00067 virtual bool LateInit(cDevice *dev); 00068 virtual bool EarlyShutdown(cDevice *dev); 00069 virtual bool SetCaDescr(cDevice *dev, ca_descr_t *ca_descr, bool initial); 00070 virtual bool SetCaPid(cDevice *dev, ca_pid_t *ca_pid); 00071 }; 00072 00073 static cScHdDevicePlugin _hddevplugin; 00074 00075 cDevice *cScHdDevicePlugin::Probe(int Adapter, int Frontend, uint32_t SubSystemId) 00076 { 00077 static uint32_t SubsystemIds[] = { 00078 0x13C23009, // Technotrend S2-6400 HDFF development samples 00079 0x13C2300A, // Technotrend S2-6400 HDFF production version 00080 0x00000000 00081 }; 00082 for(uint32_t *sid=SubsystemIds; *sid; sid++) { 00083 if(*sid==SubSystemId) { 00084 int fd=cScDevices::DvbOpen(DEV_DVB_OSD,Adapter,0,O_RDWR); 00085 if(fd>=0) { 00086 close(fd); 00087 PRINTF(L_GEN_DEBUG,"creating HD-FF device %d/%d",Adapter,Frontend); 00088 return new cScDvbHdFfDevice(this,Adapter,Frontend,cScDevices::DvbOpen(DEV_DVB_CA,Adapter,Frontend,O_RDWR)); 00089 } 00090 } 00091 } 00092 return 0; 00093 } 00094 00095 bool cScHdDevicePlugin::LateInit(cDevice *dev) 00096 { 00097 cScDvbHdFfDevice *d=dynamic_cast<cScDvbHdFfDevice *>(dev); 00098 if(d) d->LateInit(); 00099 return d!=0; 00100 } 00101 00102 bool cScHdDevicePlugin::EarlyShutdown(cDevice *dev) 00103 { 00104 cScDvbHdFfDevice *d=dynamic_cast<cScDvbHdFfDevice *>(dev); 00105 if(d) d->EarlyShutdown(); 00106 return d!=0; 00107 } 00108 00109 bool cScHdDevicePlugin::SetCaDescr(cDevice *dev, ca_descr_t *ca_descr, bool initial) 00110 { 00111 cScDvbHdFfDevice *d=dynamic_cast<cScDvbHdFfDevice *>(dev); 00112 if(d) return d->SetCaDescr(ca_descr,initial); 00113 return false; 00114 } 00115 00116 bool cScHdDevicePlugin::SetCaPid(cDevice *dev, ca_pid_t *ca_pid) 00117 { 00118 cScDvbHdFfDevice *d=dynamic_cast<cScDvbHdFfDevice *>(dev); 00119 if(d) return d->SetCaPid(ca_pid); 00120 return false; 00121 } 00122 00123 #endif //WITH_HDDVB 00124 #endif //APIVERSNUM >= 10711 00125 #endif //SASC