From afc17c1168f4eae489d0f728568898f07e72aeea Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 4 Jan 2015 13:36:46 +0100 Subject: The pid of the PMT in which the CA descriptors of a given channel are broadcast is now stored together with the CA descriptors --- HISTORY | 6 +++++- pat.c | 27 +++++++++++++++++++++++---- pat.h | 5 ++++- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/HISTORY b/HISTORY index c5ef9406..ae644322 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-01: Version 2.1.7 +2015-01-04: 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 @@ -8323,3 +8323,7 @@ Video Disk Recorder Revision History - Updated the dvbhddevice plugin source. - Fixed a bug in the Makefile when installing plugins with LCLBLD=1 (thanks to Stefan Huelswitt). +- The pid of the PMT in which the CA descriptors of a given channel are broadcast + is now stored together with the CA descriptors and can be retrieved by calling + GetPmtPid() (this information is only required to receive encrypted channels + with the OctopusNet receiver via the 'satip' plugin). diff --git a/pat.c b/pat.c index c325a00c..98d306eb 100644 --- a/pat.c +++ b/pat.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: pat.c 3.4 2014/02/19 08:57:43 kls Exp $ + * $Id: pat.c 3.5 2015/01/04 13:14:01 kls Exp $ */ #include "pat.h" @@ -69,12 +69,13 @@ private: int source; int transponder; int serviceId; + int pmtPid; // needed for OctopusNet - otherwise irrelevant! int numCaIds; int caIds[MAXCAIDS + 1]; cList caDescriptors; void AddCaId(int CaId); public: - cCaDescriptors(int Source, int Transponder, int ServiceId); + cCaDescriptors(int Source, int Transponder, int ServiceId, int PmtPid); bool operator== (const cCaDescriptors &arg) const; bool Is(int Source, int Transponder, int ServiceId); bool Is(cCaDescriptors * CaDescriptors); @@ -82,14 +83,16 @@ public: void AddCaDescriptor(SI::CaDescriptor *d, int EsPid); int GetCaDescriptors(const int *CaSystemIds, int BufSize, uchar *Data, int EsPid); int GetCaPids(const int *CaSystemIds, int BufSize, int *Pids); + const int GetPmtPid(void) { return pmtPid; }; const int *CaIds(void) { return caIds; } }; -cCaDescriptors::cCaDescriptors(int Source, int Transponder, int ServiceId) +cCaDescriptors::cCaDescriptors(int Source, int Transponder, int ServiceId, int PmtPid) { source = Source; transponder = Transponder; serviceId = ServiceId; + pmtPid = PmtPid; numCaIds = 0; caIds[0] = 0; } @@ -218,6 +221,7 @@ public: // and 2 if an existing descriptor was changed. int GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, uchar *Data, int EsPid); int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids); + int GetPmtPid(int Source, int Transponder, int ServiceId); }; int cCaDescriptorHandler::AddCaDescriptors(cCaDescriptors *CaDescriptors) @@ -258,6 +262,16 @@ int cCaDescriptorHandler::GetCaPids(int Source, int Transponder, int ServiceId, return 0; } +int cCaDescriptorHandler::GetPmtPid(int Source, int Transponder, int ServiceId) +{ + cMutexLock MutexLock(&mutex); + for (cCaDescriptors *ca = First(); ca; ca = Next(ca)) { + if (ca->Is(Source, Transponder, ServiceId)) + return ca->GetPmtPid(); + } + return 0; +} + cCaDescriptorHandler CaDescriptorHandler; int GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, uchar *Data, int EsPid) @@ -270,6 +284,11 @@ int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds return CaDescriptorHandler.GetCaPids(Source, Transponder, ServiceId, CaSystemIds, BufSize, Pids); } +int GetPmtPid(int Source, int Transponder, int ServiceId) +{ + return CaDescriptorHandler.GetPmtPid(Source, Transponder, ServiceId); +} + // --- cPatFilter ------------------------------------------------------------ //#define DEBUG_PAT_PMT @@ -384,7 +403,7 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length cChannel *Channel = Channels.GetByServiceID(Source(), Transponder(), pmt.getServiceId()); if (Channel) { SI::CaDescriptor *d; - cCaDescriptors *CaDescriptors = new cCaDescriptors(Channel->Source(), Channel->Transponder(), Channel->Sid()); + cCaDescriptors *CaDescriptors = new cCaDescriptors(Channel->Source(), Channel->Transponder(), Channel->Sid(), Pid); // Scan the common loop: for (SI::Loop::Iterator it; (d = (SI::CaDescriptor*)pmt.commonDescriptors.getNext(it, SI::CaDescriptorTag)); ) { CaDescriptors->AddCaDescriptor(d, 0); diff --git a/pat.h b/pat.h index 993a9b96..19e60dcf 100644 --- a/pat.h +++ b/pat.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: pat.h 3.3 2014/02/18 11:22:34 kls Exp $ + * $Id: pat.h 3.4 2015/01/04 13:17:22 kls Exp $ */ #ifndef __PAT_H @@ -56,4 +56,7 @@ int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds ///< Returns the number of pids copied into Pids (0 if no CA descriptors are ///< available), or -1 if BufSize was too small to hold all CA pids. +int GetPmtPid(int Source, int Transponder, int ServiceId); + ///< Gets the Pid of the PMT in which the CA descriptors for this channel are defined. + #endif //__PAT_H -- cgit v1.2.3