diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2006-01-07 15:16:09 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2006-01-07 15:16:09 +0100 |
commit | e8ee9a1c4b26c38a46e5872a62cb020473c949c9 (patch) | |
tree | 34b11f6209fef8a2269d2b80dbb85724b85ddd42 | |
parent | e0d5ebf8fd1d508776d63026a9dd336fbb0d648d (diff) | |
download | vdr-e8ee9a1c4b26c38a46e5872a62cb020473c949c9.tar.gz vdr-e8ee9a1c4b26c38a46e5872a62cb020473c949c9.tar.bz2 |
Adapted c(Dvb)Device::ProvidesCa() to the dynamic CA handling
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | ci.c | 11 | ||||
-rw-r--r-- | ci.h | 4 | ||||
-rw-r--r-- | device.c | 6 | ||||
-rw-r--r-- | device.h | 20 | ||||
-rw-r--r-- | dvbdevice.c | 22 |
6 files changed, 43 insertions, 21 deletions
@@ -4126,3 +4126,4 @@ Video Disk Recorder Revision History Andreas Böttger). - The file 'ca.conf' is obsolete and has been removed. - Revised all descriptions regarding CICAM. +- Adapted c(Dvb)Device::ProvidesCa() to the dynamic CA handling. @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: ci.c 1.41 2005/12/30 15:41:38 kls Exp $ + * $Id: ci.c 1.42 2006/01/07 15:07:16 kls Exp $ */ #include "ci.h" @@ -1639,6 +1639,15 @@ int cCiHandler::CloseAllSessions(int Slot) return result; } +int cCiHandler::NumCams(void) +{ + int result = 0; + for (int i = 0; i < MAX_CI_SLOT; i++) + if (moduleReady[i]) + result++; + return result; +} + bool cCiHandler::Ready(void) { cMutexLock MutexLock(&mutex); @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: ci.h 1.20 2005/12/03 11:59:05 kls Exp $ + * $Id: ci.h 1.21 2006/01/07 15:03:05 kls Exp $ */ #ifndef __CI_H @@ -127,6 +127,8 @@ public: ///< Creates a new cCiHandler for the given CA device. int NumSlots(void) { return numSlots; } ///< Returns the number of CAM slots provided by this CA device. + int NumCams(void); + ///< Returns the number of actual CAMs inserted into this CA device. bool Ready(void); ///< Returns true if all CAMs in this CA device are ready. bool Process(int Slot = -1); @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 1.118 2006/01/07 14:09:17 kls Exp $ + * $Id: device.c 1.119 2006/01/07 14:50:45 kls Exp $ */ #include "device.h" @@ -302,7 +302,7 @@ cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool *NeedsDe pri = 6; // receiving with same priority but fewer Ca's else pri = 7; // all others - if (pri < select) { + if (pri <= select) { select = pri; d = device[i]; if (NeedsDetachReceivers) @@ -1147,7 +1147,7 @@ int cDevice::ProvidesCa(const cChannel *Channel) const int Ca = Channel->Ca(); if (Ca == CardIndex() + 1) return 1; // exactly _this_ card was requested - if (Ca && Ca <= MAXDEVICES) + if (Ca && Ca <= CA_DVB_MAX) return 0; // a specific card was requested, but not _this_ one return !Ca; // by default every card can provide FTA } @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.h 1.68 2006/01/06 13:20:25 kls Exp $ + * $Id: device.h 1.69 2006/01/07 14:50:45 kls Exp $ */ #ifndef __DEVICE_H @@ -170,14 +170,16 @@ public: ///< Returns the card index of this device (0 ... MAXDEVICES - 1). int DeviceNumber(void) const; ///< Returns the number of this device (0 ... MAXDEVICES - 1). - virtual int ProvidesCa(const cChannel *Channel) const;//XXX PLUGINS.html!!! - //XXX describe changed functionality!!! - ///< Checks whether this device provides the given value in its - ///< caCaps. Returns 0 if the value is not provided, 1 if only this - ///< value is provided, and > 1 if this and other values are provided. - ///< If the given value is equal to the number of this device, - ///< 1 is returned. If it is 0 (FTA), 1 plus the number of other values - ///< in caCaps is returned. + virtual int ProvidesCa(const cChannel *Channel) const; + ///< Checks whether this device provides the conditional access + ///< facilities to decrypt the given Channel. + ///< Returns 0 if the Channel can't be decrypted, 1 if this is a + ///< Free To Air channel or only exactly this device can decrypt it, + ///< and > 1 if this device can decrypt the Channel. + ///< If the result is greater than 1 and the device has more than one + ///< CAM, the value will be increased by the number of CAMs, which + ///< allows to select the device with the smallest number of CAMs + ///< in order to preserve resources for other recordings. virtual bool HasDecoder(void) const; ///< Tells whether this device has an MPEG decoder. diff --git a/dvbdevice.c b/dvbdevice.c index 52c52cea..7fa39cce 100644 --- a/dvbdevice.c +++ b/dvbdevice.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.c 1.148 2006/01/07 14:05:59 kls Exp $ + * $Id: dvbdevice.c 1.149 2006/01/07 15:15:01 kls Exp $ */ #include "dvbdevice.h" @@ -503,13 +503,21 @@ bool cDvbDevice::Ready(void) int cDvbDevice::ProvidesCa(const cChannel *Channel) const { - if (Channel->Ca() >= CA_ENCRYPTED_MIN && ciHandler) { - unsigned short ids[MAXCAIDS + 1]; - for (int i = 0; i <= MAXCAIDS; i++) // '<=' copies the terminating 0! - ids[i] = Channel->Ca(i); - return ciHandler->ProvidesCa(ids); + int NumCams = 0; + if (ciHandler) { + NumCams = ciHandler->NumCams(); + if (Channel->Ca() >= CA_ENCRYPTED_MIN) { + unsigned short ids[MAXCAIDS + 1]; + for (int i = 0; i <= MAXCAIDS; i++) // '<=' copies the terminating 0! + ids[i] = Channel->Ca(i); + if (ciHandler->ProvidesCa(ids)) + return NumCams + 1; + } } - return cDevice::ProvidesCa(Channel); + int result = cDevice::ProvidesCa(Channel); + if (result > 0) + result += NumCams; + return result; } cSpuDecoder *cDvbDevice::GetSpuDecoder(void) |