summaryrefslogtreecommitdiff
path: root/ci.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2015-01-15 09:28:37 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2015-01-15 09:28:37 +0100
commitb3954aefd5290babbc2aa97b8f62b6112ff494f0 (patch)
tree3887b265796f646f3e94ab519e8d281eb23b8e46 /ci.c
parent555fe68a018e193193f916c5e7c888c0a386e9fe (diff)
downloadvdr-b3954aefd5290babbc2aa97b8f62b6112ff494f0.tar.gz
vdr-b3954aefd5290babbc2aa97b8f62b6112ff494f0.tar.bz2
Modified the CAM API so that it is possible to implement CAMs that can be freely assigned to any devices
Diffstat (limited to 'ci.c')
-rw-r--r--ci.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/ci.c b/ci.c
index fdba14fa..1072695c 100644
--- a/ci.c
+++ b/ci.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: ci.c 3.16 2015/01/13 14:42:32 kls Exp $
+ * $Id: ci.c 3.17 2015/01/15 09:14:57 kls Exp $
*/
#include "ci.h"
@@ -1631,7 +1631,6 @@ public:
cCiAdapter::cCiAdapter(void)
:cThread("CI adapter")
{
- assignedDevice = NULL;
for (int i = 0; i < MAX_CAM_SLOTS_PER_ADAPTER; i++)
camSlots[i] = NULL;
}
@@ -1657,6 +1656,17 @@ void cCiAdapter::AddCamSlot(cCamSlot *CamSlot)
}
}
+cCamSlot *cCiAdapter::ItCamSlot(int &Iter)
+{
+ if (Iter >= 0) {
+ for (; Iter < MAX_CAM_SLOTS_PER_ADAPTER; ) {
+ if (cCamSlot *Found = camSlots[Iter++])
+ return Found;
+ }
+ }
+ return NULL;
+}
+
void cCiAdapter::Action(void)
{
cTPDU TPDU;
@@ -1684,6 +1694,7 @@ void cCiAdapter::Action(void)
cCamSlot::cCamSlot(cCiAdapter *CiAdapter, bool ReceiveCaPids)
{
ciAdapter = CiAdapter;
+ assignedDevice = NULL;
caPidReceiver = ReceiveCaPids ? new cCaPidReceiver : NULL;
slotIndex = -1;
lastModuleStatus = msReset; // avoids initial reset log message
@@ -1701,8 +1712,8 @@ cCamSlot::cCamSlot(cCiAdapter *CiAdapter, bool ReceiveCaPids)
cCamSlot::~cCamSlot()
{
- if (ciAdapter && ciAdapter->assignedDevice)
- ciAdapter->assignedDevice->SetCamSlot(NULL);
+ if (assignedDevice)
+ assignedDevice->SetCamSlot(NULL);
delete caPidReceiver;
CamSlots.Del(this, false);
DeleteAllConnections();
@@ -1713,13 +1724,13 @@ bool cCamSlot::Assign(cDevice *Device, bool Query)
cMutexLock MutexLock(&mutex);
if (ciAdapter) {
if (ciAdapter->Assign(Device, true)) {
- if (!Device && ciAdapter->assignedDevice)
- ciAdapter->assignedDevice->SetCamSlot(NULL);
+ if (!Device && assignedDevice)
+ assignedDevice->SetCamSlot(NULL);
if (!Query) {
StopDecrypting();
source = transponder = 0;
if (ciAdapter->Assign(Device)) {
- ciAdapter->assignedDevice = Device;
+ assignedDevice = Device;
if (Device) {
Device->SetCamSlot(this);
dsyslog("CAM %d: assigned to device %d", slotNumber, Device->DeviceNumber() + 1);
@@ -1736,17 +1747,6 @@ bool cCamSlot::Assign(cDevice *Device, bool Query)
return false;
}
-cDevice *cCamSlot::Device(void)
-{
- cMutexLock MutexLock(&mutex);
- if (ciAdapter) {
- cDevice *d = ciAdapter->assignedDevice;
- if (d && d->CamSlot() == this)
- return d;
- }
- return NULL;
-}
-
void cCamSlot::NewConnection(void)
{
cMutexLock MutexLock(&mutex);