From 1d869c4b36d1e1a48a9a3acb6bad58f952302cc0 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Tue, 14 Jan 2014 14:39:59 +0100 Subject: Fixed sending CA descriptors to CAMs in case a cReceiver is not used for a recording or live view, like e.g. streaming clients --- CONTRIBUTORS | 4 ++++ HISTORY | 2 ++ ci.c | 17 +++++++++++++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 757ae32e..a356b2cd 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3237,3 +3237,7 @@ Thomas Reufer for suggesting to add an additional parameter named Forward to cDevice::TrickSpeed() for suggesting to add a note to ePlayMode in device.h that VDR itself always uses pmAudioVideo when replaying a recording + +Mariusz Bialonczyk + for fixing sending CA descriptors to CAMs in case a cReceiver is not used for a + recording or live view, like e.g. streaming clients diff --git a/HISTORY b/HISTORY index 400ad11c..94825ad9 100644 --- a/HISTORY +++ b/HISTORY @@ -8140,3 +8140,5 @@ Video Disk Recorder Revision History - Improved locking for CAM slots and made the pure functions of cCiAdapter have default implementations, to fix a possible crash with CI adapters and CAM slots that are implemented in a plugin. +- Fixed sending CA descriptors to CAMs in case a cReceiver is not used for a + recording or live view, like e.g. streaming clients (thanks to Mariusz Bialonczyk). diff --git a/ci.c b/ci.c index 56a4583e..0336a7bf 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.5 2014/01/14 12:03:37 kls Exp $ + * $Id: ci.c 3.6 2014/01/14 14:36:29 kls Exp $ */ #include "ci.h" @@ -592,6 +592,7 @@ private: int transponder; int programNumber; int caSystemIds[MAXCASYSTEMIDS + 1]; // list is zero terminated! + bool gotCaDescriptors; void AddCaDescriptors(int Length, const uint8_t *Data); public: cCiCaPmt(uint8_t CmdId, int Source, int Transponder, int ProgramNumber, const int *CaSystemIds); @@ -599,10 +600,12 @@ public: void SetListManagement(uint8_t ListManagement); uint8_t ListManagement(void) { return capmt[0]; } void AddPid(int Pid, uint8_t StreamType); + bool GotCaDescriptors(void) { return gotCaDescriptors; } }; cCiCaPmt::cCiCaPmt(uint8_t CmdId, int Source, int Transponder, int ProgramNumber, const int *CaSystemIds) { + gotCaDescriptors = false; cmdId = CmdId; source = Source; transponder = Transponder; @@ -658,6 +661,7 @@ void cCiCaPmt::AddCaDescriptors(int Length, const uint8_t *Data) int l = length - esInfoLengthPos - 2; capmt[esInfoLengthPos] = (l >> 8) & 0xFF; capmt[esInfoLengthPos + 1] = l & 0xFF; + gotCaDescriptors = true; } } else @@ -1812,6 +1816,7 @@ cCiEnquiry *cCamSlot::GetEnquiry(void) void cCamSlot::SendCaPmt(uint8_t CmdId) { cMutexLock MutexLock(&mutex); + bool needResend = false; cCiConditionalAccessSupport *cas = (cCiConditionalAccessSupport *)GetSessionByResourceId(RI_CONDITIONAL_ACCESS_SUPPORT); if (cas) { const int *CaSystemIds = cas->GetCaSystemIds(); @@ -1844,8 +1849,12 @@ void cCamSlot::SendCaPmt(uint8_t CmdId) } if (cas->RepliesToQuery()) CaPmt.SetListManagement(Active ? CPLM_ADD : CPLM_UPDATE); - if (Active || cas->RepliesToQuery()) - cas->SendPMT(&CaPmt); + if (Active || cas->RepliesToQuery()) { + if ((CaPmt.ListManagement() == CPLM_ADD || CaPmt.ListManagement() == CPLM_ONLY) && !CaPmt.GotCaDescriptors()) + needResend = true; + else + cas->SendPMT(&CaPmt); + } p->modified = false; } } @@ -1855,7 +1864,7 @@ void cCamSlot::SendCaPmt(uint8_t CmdId) if (cDevice *d = Device()) d->AttachReceiver(caPidReceiver); } - resendPmt = false; + resendPmt = needResend; } else { cCiCaPmt CaPmt(CmdId, 0, 0, 0, NULL); -- cgit v1.2.3