summaryrefslogtreecommitdiff
path: root/pat.c
diff options
context:
space:
mode:
Diffstat (limited to 'pat.c')
-rw-r--r--pat.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/pat.c b/pat.c
index a7791e2a..9f5f12de 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 2.19 2012/11/25 14:12:21 kls Exp $
+ * $Id: pat.c 3.1 2014/01/01 12:02:39 kls Exp $
*/
#include "pat.h"
@@ -21,6 +21,7 @@
class cCaDescriptor : public cListObject {
private:
int caSystem;
+ int caPid;
int esPid;
int length;
uchar *data;
@@ -29,6 +30,7 @@ public:
virtual ~cCaDescriptor();
bool operator== (const cCaDescriptor &arg) const;
int CaSystem(void) { return caSystem; }
+ int CaPid(void) { return caPid; }
int EsPid(void) { return esPid; }
int Length(void) const { return length; }
const uchar *Data(void) const { return data; }
@@ -37,6 +39,7 @@ public:
cCaDescriptor::cCaDescriptor(int CaSystem, int CaPid, int EsPid, int Length, const uchar *Data)
{
caSystem = CaSystem;
+ caPid = CaPid;
esPid = EsPid;
length = Length + 6;
data = MALLOC(uchar, length);
@@ -79,6 +82,7 @@ public:
bool Empty(void) { return caDescriptors.Count() == 0; }
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 *CaIds(void) { return caIds; }
};
@@ -179,6 +183,30 @@ int cCaDescriptors::GetCaDescriptors(const int *CaSystemIds, int BufSize, uchar
return -1;
}
+int cCaDescriptors::GetCaPids(const int *CaSystemIds, int BufSize, int *Pids)
+{
+ if (!CaSystemIds || !*CaSystemIds)
+ return 0;
+ if (BufSize > 0 && Pids) {
+ int numPids = 0;
+ for (cCaDescriptor *d = caDescriptors.First(); d; d = caDescriptors.Next(d)) {
+ const int *caids = CaSystemIds;
+ do {
+ if (d->CaSystem() == *caids) {
+ if (numPids + 1 < BufSize) {
+ Pids[numPids++] = d->CaPid();
+ Pids[numPids] = 0;
+ }
+ else
+ return -1;
+ }
+ } while (*++caids);
+ }
+ return numPids;
+ }
+ return -1;
+}
+
// --- cCaDescriptorHandler --------------------------------------------------
class cCaDescriptorHandler : public cList<cCaDescriptors> {
@@ -190,6 +218,7 @@ public:
// 1 if it is an all new descriptor with actual contents,
// 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 cCaDescriptorHandler::AddCaDescriptors(cCaDescriptors *CaDescriptors)
@@ -220,6 +249,16 @@ int cCaDescriptorHandler::GetCaDescriptors(int Source, int Transponder, int Serv
return 0;
}
+int cCaDescriptorHandler::GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids)
+{
+ cMutexLock MutexLock(&mutex);
+ for (cCaDescriptors *ca = First(); ca; ca = Next(ca)) {
+ if (ca->Is(Source, Transponder, ServiceId))
+ return ca->GetCaPids(CaSystemIds, BufSize, Pids);
+ }
+ return 0;
+}
+
cCaDescriptorHandler CaDescriptorHandler;
int GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, uchar *Data, int EsPid)
@@ -227,6 +266,11 @@ int GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSy
return CaDescriptorHandler.GetCaDescriptors(Source, Transponder, ServiceId, CaSystemIds, BufSize, Data, EsPid);
}
+int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids)
+{
+ return CaDescriptorHandler.GetCaPids(Source, Transponder, ServiceId, CaSystemIds, BufSize, Pids);
+}
+
// --- cPatFilter ------------------------------------------------------------
cPatFilter::cPatFilter(void)