summaryrefslogtreecommitdiff
path: root/ci.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2017-02-21 14:17:07 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2017-02-21 14:17:07 +0100
commit3f9cdea1c16cb25b7a3ce7c875d46e6d100d593d (patch)
tree20844e355df620ea67229a18b00212290f31c28d /ci.c
parent71601e363e730bc073dcc435da8de1d0e3453436 (diff)
downloadvdr-3f9cdea1c16cb25b7a3ce7c875d46e6d100d593d.tar.gz
vdr-3f9cdea1c16cb25b7a3ce7c875d46e6d100d593d.tar.bz2
PIDs can now be added to and deleted from a cReceiver while it is attached to a cDevice
Diffstat (limited to 'ci.c')
-rw-r--r--ci.c48
1 files changed, 15 insertions, 33 deletions
diff --git a/ci.c b/ci.c
index 1096721b..8f2256e3 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 4.5 2017/01/23 11:42:14 kls Exp $
+ * $Id: ci.c 4.6 2017/02/21 14:17:07 kls Exp $
*/
#include "ci.h"
@@ -121,8 +121,6 @@ private:
int length;
void AddEmmPid(int Pid);
void DelEmmPids(void);
-protected:
- virtual void Activate(bool On);
public:
cCaPidReceiver(void);
virtual ~cCaPidReceiver() { Detach(); }
@@ -156,11 +154,6 @@ void cCaPidReceiver::DelEmmPids(void)
emmPids.Clear();
}
-void cCaPidReceiver::Activate(bool On)
-{
- catVersion = -1; // can be done independent of 'On'
-}
-
void cCaPidReceiver::Receive(const uchar *Data, int Length)
{
if (TsPid(Data) == CATPID) {
@@ -208,10 +201,6 @@ void cCaPidReceiver::Receive(const uchar *Data, int Length)
}
}
if (p) {
- int OldCatVersion = catVersion; // must preserve the current version number
- cDevice *AttachedDevice = Device();
- if (AttachedDevice)
- AttachedDevice->Detach(this);
DelEmmPids();
for (int i = 0; i < length - 4; i++) { // -4 = checksum
if (p[i] == 0x09) {
@@ -228,9 +217,6 @@ void cCaPidReceiver::Receive(const uchar *Data, int Length)
i += p[i + 1] + 2 - 1; // -1 to compensate for the loop increment
}
}
- if (AttachedDevice)
- AttachedDevice->AttachReceiver(this);
- catVersion = OldCatVersion;
p = NULL;
bufp = 0;
length = 0;
@@ -1747,9 +1733,10 @@ cCamSlot::cCamSlot(cCiAdapter *CiAdapter, bool WantsTsData, cCamSlot *MasterSlot
tc[i] = NULL;
CamSlots.Add(this);
slotNumber = Index() + 1;
- if (ciAdapter)
+ if (ciAdapter) {
ciAdapter->AddCamSlot(this);
- Reset();
+ Reset();
+ }
}
cCamSlot::~cCamSlot()
@@ -1767,20 +1754,28 @@ bool cCamSlot::Assign(cDevice *Device, bool Query)
cMutexLock MutexLock(&mutex);
if (ciAdapter) {
if (ciAdapter->Assign(Device, true)) {
- if (!Device && assignedDevice)
+ if (!Device && assignedDevice) {
+ if (caPidReceiver)
+ assignedDevice->Detach(caPidReceiver);
assignedDevice->SetCamSlot(NULL);
+ }
if (!Query || !Device) {
StopDecrypting();
source = transponder = 0;
if (ciAdapter->Assign(Device)) {
+ int OldDeviceNumber = assignedDevice ? assignedDevice->DeviceNumber() + 1 : 0;
assignedDevice = Device;
if (Device) {
Device->SetCamSlot(this);
- dsyslog("CAM %d: assigned to device %d", slotNumber, Device->DeviceNumber() + 1);
+ if (caPidReceiver) {
+ caPidReceiver->Reset();
+ Device->AttachReceiver(caPidReceiver);
+ }
+ dsyslog("CAM %d: assigned to device %d", MasterSlotNumber(), Device->DeviceNumber() + 1);
}
else {
CancelActivation();
- dsyslog("CAM %d: unassigned", slotNumber);
+ dsyslog("CAM %d: unassigned from device %d", MasterSlotNumber(), OldDeviceNumber);
}
}
else
@@ -2014,10 +2009,6 @@ void cCamSlot::SendCaPmt(uint8_t CmdId)
const int *CaSystemIds = cas->GetCaSystemIds();
if (CaSystemIds && *CaSystemIds) {
if (caProgramList.Count()) {
- if (caPidReceiver && caPidReceiver->HasCaPids()) {
- if (cDevice *d = Device())
- d->Detach(caPidReceiver);
- }
for (int Loop = 1; Loop <= 2; Loop++) {
for (cCiCaProgramData *p = caProgramList.First(); p; p = caProgramList.Next(p)) {
if (p->modified || resendPmt) {
@@ -2048,20 +2039,11 @@ void cCamSlot::SendCaPmt(uint8_t CmdId)
}
}
}
- if (caPidReceiver && caPidReceiver->HasCaPids()) {
- if (cDevice *d = Device())
- d->AttachReceiver(caPidReceiver);
- }
resendPmt = false;
}
else {
cCiCaPmt CaPmt(CmdId, 0, 0, 0, NULL);
cas->SendPMT(&CaPmt);
- if (caPidReceiver) {
- if (cDevice *d = Device())
- d->Detach(caPidReceiver);
- caPidReceiver->Reset();
- }
}
}
}