summaryrefslogtreecommitdiff
path: root/ci.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2014-01-01 12:37:22 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2014-01-01 12:37:22 +0100
commit566c6fa4641ea116307cfb5e40d151a104ab1490 (patch)
tree4d541f4e23394b252898ab302be48bfb59fd5463 /ci.c
parentb95b85fee4a7c26bfbc2890ac3ff00cef5fa0388 (diff)
downloadvdr-566c6fa4641ea116307cfb5e40d151a104ab1490.tar.gz
vdr-566c6fa4641ea116307cfb5e40d151a104ab1490.tar.bz2
Added receiving Ca pids to cCamSlot
Diffstat (limited to 'ci.c')
-rw-r--r--ci.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/ci.c b/ci.c
index 92aaf722..2d9735e5 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.2 2013/12/29 15:51:08 kls Exp $
+ * $Id: ci.c 3.3 2014/01/01 12:33:27 kls Exp $
*/
#include "ci.h"
@@ -19,6 +19,7 @@
#include <unistd.h>
#include "device.h"
#include "pat.h"
+#include "receiver.h"
#include "tools.h"
// Set these to 'true' for debug output:
@@ -102,6 +103,16 @@ static char *GetString(int &Length, const uint8_t **Data)
return NULL;
}
+// --- cCaPidReceiver --------------------------------------------------------
+
+// A dummy receiver, just used to make the device receive the CA pids.
+
+class cCaPidReceiver : public cReceiver {
+public:
+ virtual ~cCaPidReceiver() { Detach(); }
+ virtual void Receive(uchar *Data, int Length) {}
+ };
+
// --- cTPDU -----------------------------------------------------------------
#define MAX_TPDU_SIZE 2048
@@ -570,7 +581,7 @@ bool cCiApplicationInformation::EnterMenu(void)
#define CPCI_QUERY 0x03
#define CPCI_NOT_SELECTED 0x04
-class cCiCaPmt : public cListObject {
+class cCiCaPmt {
friend class cCiConditionalAccessSupport;
private:
uint8_t cmdId;
@@ -1553,9 +1564,10 @@ cCamSlots CamSlots;
#define MODULE_CHECK_INTERVAL 500 // ms
#define MODULE_RESET_TIMEOUT 2 // s
-cCamSlot::cCamSlot(cCiAdapter *CiAdapter)
+cCamSlot::cCamSlot(cCiAdapter *CiAdapter, bool ReceiveCaPids)
{
ciAdapter = CiAdapter;
+ caPidReceiver = ReceiveCaPids ? new cCaPidReceiver : NULL;
slotIndex = -1;
lastModuleStatus = msReset; // avoids initial reset log message
resetTime = 0;
@@ -1572,6 +1584,7 @@ cCamSlot::cCamSlot(cCiAdapter *CiAdapter)
cCamSlot::~cCamSlot()
{
+ delete caPidReceiver;
CamSlots.Del(this, false);
DeleteAllConnections();
}
@@ -1802,6 +1815,10 @@ void cCamSlot::SendCaPmt(uint8_t CmdId)
const int *CaSystemIds = cas->GetCaSystemIds();
if (CaSystemIds && *CaSystemIds) {
if (caProgramList.Count()) {
+ if (caPidReceiver && caPidReceiver->NumPids()) {
+ 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) {
@@ -1814,6 +1831,15 @@ void cCamSlot::SendCaPmt(uint8_t CmdId)
}
}
if ((Loop == 1) != Active) { // first remove, then add
+ if (caPidReceiver) {
+ int CaPids[MAXRECEIVEPIDS + 1];
+ if (GetCaPids(source, transponder, p->programNumber, CaSystemIds, MAXRECEIVEPIDS + 1, CaPids) > 0) {
+ if (Loop == 1)
+ caPidReceiver->DelPids(CaPids);
+ else
+ caPidReceiver->AddPids(CaPids);
+ }
+ }
if (cas->RepliesToQuery())
CaPmt.SetListManagement(Active ? CPLM_ADD : CPLM_UPDATE);
if (Active || cas->RepliesToQuery())
@@ -1823,6 +1849,10 @@ void cCamSlot::SendCaPmt(uint8_t CmdId)
}
}
}
+ if (caPidReceiver && caPidReceiver->NumPids()) {
+ if (cDevice *d = Device())
+ d->AttachReceiver(caPidReceiver);
+ }
resendPmt = false;
}
else {