summaryrefslogtreecommitdiff
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
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
-rw-r--r--CONTRIBUTORS4
-rw-r--r--HISTORY4
-rw-r--r--ci.c36
-rw-r--r--ci.h10
4 files changed, 32 insertions, 22 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index bc5c13db..a60a54c7 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -3315,3 +3315,7 @@ Claus Muus <email@clausmuus.de>
Dieter Ferdinand <dieter.ferdinand@gmx.de>
for reporting a problem with jumping to an absolute position via the Red key in
case replay was paused
+
+Jasmin Jessich <jasmin@anw.at>
+ for modifying the CAM API so that it is possible to implement CAMs that can be freely
+ assigned to any devices
diff --git a/HISTORY b/HISTORY
index a7959423..1d6ea88b 100644
--- a/HISTORY
+++ b/HISTORY
@@ -8307,7 +8307,7 @@ Video Disk Recorder Revision History
- The APIVERSION has been increased to 2.0.6 due to the changes to pat.h, sdt.h and
the functional modification to cFont::CreateFont().
-2015-01-14: Version 2.1.7
+2015-01-15: Version 2.1.7
- No longer logging an error message in DirSizeMB() if the given directory doesn't
exist. This avoids lots of log entries in case several VDRs use the same video
@@ -8371,3 +8371,5 @@ Video Disk Recorder Revision History
want to do the same.
- Added the channel name to log messages that reference a channel (suggested by
Dietmar Spingler).
+- Modified the CAM API so that it is possible to implement CAMs that can be freely
+ assigned to any devices (thanks to Jasmin Jessich).
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);
diff --git a/ci.h b/ci.h
index 4d558537..8fea34f1 100644
--- a/ci.h
+++ b/ci.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: ci.h 3.8 2014/03/26 11:42:17 kls Exp $
+ * $Id: ci.h 3.9 2015/01/15 09:18:09 kls Exp $
*/
#ifndef __CI_H
@@ -79,11 +79,14 @@ enum eModuleStatus { msNone, msReset, msPresent, msReady };
class cCiAdapter : public cThread {
friend class cCamSlot;
private:
- cDevice *assignedDevice;
cCamSlot *camSlots[MAX_CAM_SLOTS_PER_ADAPTER];
void AddCamSlot(cCamSlot *CamSlot);
///< Adds the given CamSlot to this CI adapter.
protected:
+ cCamSlot *ItCamSlot(int &Iter);
+ ///< Iterates over all added CAM slots of this adapter. Iter has to be
+ ///< initialized to 0 and is required to store the iteration state.
+ ///< Returns NULL if no further CAM slot is found.
virtual void Action(void);
///< Handles the attached CAM slots in a separate thread.
///< The derived class must call the Start() function to
@@ -128,6 +131,7 @@ private:
cMutex mutex;
cCondVar processed;
cCiAdapter *ciAdapter;
+ cDevice *assignedDevice;
cCaPidReceiver *caPidReceiver;
int slotIndex;
int slotNumber;
@@ -164,7 +168,7 @@ public:
///< device it was previously assigned to. The value of Query
///< is ignored in that case, and this function always returns
///< 'true'.
- cDevice *Device(void);
+ cDevice *Device(void) { return assignedDevice; }
///< Returns the device this CAM slot is currently assigned to.
bool WantsTsData(void) const { return caPidReceiver != NULL; }
///< Returns true if this CAM slot wants to receive the TS data through