mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Now also taking providerId and caPid into account when handling CA descriptors
This commit is contained in:
parent
6bdfa4638d
commit
33d670f7d7
48
eit.c
48
eit.c
@ -16,7 +16,7 @@
|
|||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
* $Id: eit.c 1.71 2003/04/18 11:30:42 kls Exp $
|
* $Id: eit.c 1.72 2003/04/21 13:21:54 kls Exp $
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "eit.h"
|
#include "eit.h"
|
||||||
@ -1002,27 +1002,31 @@ bool cEIT::IsPresentFollowing()
|
|||||||
// --- cCaDescriptor ---------------------------------------------------------
|
// --- cCaDescriptor ---------------------------------------------------------
|
||||||
|
|
||||||
class cCaDescriptor : public cListObject {
|
class cCaDescriptor : public cListObject {
|
||||||
friend class cCaDescriptors;
|
friend class cSIProcessor;
|
||||||
private:
|
private:
|
||||||
int source;
|
int source;
|
||||||
int transponder;
|
int transponder;
|
||||||
int serviceId;
|
int serviceId;
|
||||||
int caSystem;
|
int caSystem;
|
||||||
|
unsigned int providerId;
|
||||||
|
int caPid;
|
||||||
int length;
|
int length;
|
||||||
uchar *data;
|
uchar *data;
|
||||||
public:
|
public:
|
||||||
cCaDescriptor(int Source, int Transponder, int ServiceId, int CaSystem, int CaPid, int Length, uchar *Data);
|
cCaDescriptor(int Source, int Transponder, int ServiceId, int CaSystem, unsigned int ProviderId, int CaPid, int Length, uchar *Data);
|
||||||
virtual ~cCaDescriptor();
|
virtual ~cCaDescriptor();
|
||||||
int Length(void) const { return length; }
|
int Length(void) const { return length; }
|
||||||
const uchar *Data(void) const { return data; }
|
const uchar *Data(void) const { return data; }
|
||||||
};
|
};
|
||||||
|
|
||||||
cCaDescriptor::cCaDescriptor(int Source, int Transponder, int ServiceId, int CaSystem, int CaPid, int Length, uchar *Data)
|
cCaDescriptor::cCaDescriptor(int Source, int Transponder, int ServiceId, int CaSystem, unsigned int ProviderId, int CaPid, int Length, uchar *Data)
|
||||||
{
|
{
|
||||||
source = Source;
|
source = Source;
|
||||||
transponder = Transponder;
|
transponder = Transponder;
|
||||||
serviceId = ServiceId;
|
serviceId = ServiceId;
|
||||||
caSystem = CaSystem;
|
caSystem = CaSystem;
|
||||||
|
providerId = ProviderId;
|
||||||
|
caPid = CaPid;
|
||||||
length = Length + 6;
|
length = Length + 6;
|
||||||
data = MALLOC(uchar, length);
|
data = MALLOC(uchar, length);
|
||||||
data[0] = DESCR_CA;
|
data[0] = DESCR_CA;
|
||||||
@ -1037,7 +1041,7 @@ cCaDescriptor::cCaDescriptor(int Source, int Transponder, int ServiceId, int CaS
|
|||||||
#ifdef DEBUG_CA_DESCRIPTORS
|
#ifdef DEBUG_CA_DESCRIPTORS
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
char *q = buffer;
|
char *q = buffer;
|
||||||
q += sprintf(q, "CAM: %04X %5d %4d", source, transponder, serviceId);
|
q += sprintf(q, "CAM: %04X %5d %5d %04X %6X %04X -", source, transponder, serviceId, caSystem, providerId, caPid);
|
||||||
for (int i = 0; i < length; i++)
|
for (int i = 0; i < length; i++)
|
||||||
q += sprintf(q, " %02X", data[i]);
|
q += sprintf(q, " %02X", data[i]);
|
||||||
dsyslog(buffer);
|
dsyslog(buffer);
|
||||||
@ -1049,22 +1053,6 @@ cCaDescriptor::~cCaDescriptor()
|
|||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- cCaDescriptors --------------------------------------------------------
|
|
||||||
|
|
||||||
class cCaDescriptors : public cList<cCaDescriptor> {
|
|
||||||
public:
|
|
||||||
const cCaDescriptor *Get(int Source, int Transponder, int ServiceId, int CaSystem);
|
|
||||||
};
|
|
||||||
|
|
||||||
const cCaDescriptor *cCaDescriptors::Get(int Source, int Transponder, int ServiceId, int CaSystem)
|
|
||||||
{
|
|
||||||
for (cCaDescriptor *ca = First(); ca; ca = Next(ca)) {
|
|
||||||
if (ca->source == Source && ca->transponder == Transponder && ca->serviceId == ServiceId && ca->caSystem == CaSystem)
|
|
||||||
return ca;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- cSIProcessor ----------------------------------------------------------
|
// --- cSIProcessor ----------------------------------------------------------
|
||||||
|
|
||||||
#define MAX_FILTERS 20
|
#define MAX_FILTERS 20
|
||||||
@ -1073,7 +1061,7 @@ const cCaDescriptor *cCaDescriptors::Get(int Source, int Transponder, int Servic
|
|||||||
int cSIProcessor::numSIProcessors = 0;
|
int cSIProcessor::numSIProcessors = 0;
|
||||||
cSchedules *cSIProcessor::schedules = NULL;
|
cSchedules *cSIProcessor::schedules = NULL;
|
||||||
cMutex cSIProcessor::schedulesMutex;
|
cMutex cSIProcessor::schedulesMutex;
|
||||||
cCaDescriptors *cSIProcessor::caDescriptors = NULL;
|
cList<cCaDescriptor> cSIProcessor::caDescriptors;
|
||||||
cMutex cSIProcessor::caDescriptorsMutex;
|
cMutex cSIProcessor::caDescriptorsMutex;
|
||||||
const char *cSIProcessor::epgDataFileName = EPGDATAFILENAME;
|
const char *cSIProcessor::epgDataFileName = EPGDATAFILENAME;
|
||||||
time_t cSIProcessor::lastDump = time(NULL);
|
time_t cSIProcessor::lastDump = time(NULL);
|
||||||
@ -1090,7 +1078,6 @@ cSIProcessor::cSIProcessor(const char *FileName)
|
|||||||
filters = NULL;
|
filters = NULL;
|
||||||
if (!numSIProcessors++) { // the first one creates them
|
if (!numSIProcessors++) { // the first one creates them
|
||||||
schedules = new cSchedules;
|
schedules = new cSchedules;
|
||||||
caDescriptors = new cCaDescriptors;
|
|
||||||
}
|
}
|
||||||
filters = (SIP_FILTER *)calloc(MAX_FILTERS, sizeof(SIP_FILTER));
|
filters = (SIP_FILTER *)calloc(MAX_FILTERS, sizeof(SIP_FILTER));
|
||||||
SetStatus(true);
|
SetStatus(true);
|
||||||
@ -1107,7 +1094,6 @@ cSIProcessor::~cSIProcessor()
|
|||||||
free(filters);
|
free(filters);
|
||||||
if (!--numSIProcessors) { // the last one deletes them
|
if (!--numSIProcessors) { // the last one deletes them
|
||||||
delete schedules;
|
delete schedules;
|
||||||
delete caDescriptors;
|
|
||||||
}
|
}
|
||||||
free(fileName);
|
free(fileName);
|
||||||
}
|
}
|
||||||
@ -1436,14 +1422,17 @@ void cSIProcessor::TriggerDump(void)
|
|||||||
lastDump = 0;
|
lastDump = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cSIProcessor::NewCaDescriptor(struct Descriptor *d, int ProgramID)
|
void cSIProcessor::NewCaDescriptor(struct Descriptor *d, int ServiceId)
|
||||||
{
|
{
|
||||||
if (DescriptorTag(d) == DESCR_CA) {
|
if (DescriptorTag(d) == DESCR_CA) {
|
||||||
struct CaDescriptor *cd = (struct CaDescriptor *)d;
|
struct CaDescriptor *cd = (struct CaDescriptor *)d;
|
||||||
if (!caDescriptors->Get(currentSource, currentTransponder, ProgramID, cd->CA_type)) {
|
|
||||||
cMutexLock MutexLock(&caDescriptorsMutex);
|
cMutexLock MutexLock(&caDescriptorsMutex);
|
||||||
caDescriptors->Add(new cCaDescriptor(currentSource, currentTransponder, ProgramID, cd->CA_type, cd->CA_PID, cd->DataLength, cd->Data));
|
|
||||||
|
for (cCaDescriptor *ca = caDescriptors.First(); ca; ca = caDescriptors.Next(ca)) {
|
||||||
|
if (ca->source == currentSource && ca->transponder == currentTransponder && ca->serviceId == ServiceId && ca->caSystem == cd->CA_type && ca->providerId == cd->ProviderID && ca->caPid == cd->CA_PID)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
caDescriptors.Add(new cCaDescriptor(currentSource, currentTransponder, ServiceId, cd->CA_type, cd->ProviderID, cd->CA_PID, cd->DataLength, cd->Data));
|
||||||
//XXX update???
|
//XXX update???
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1456,8 +1445,8 @@ int cSIProcessor::GetCaDescriptors(int Source, int Transponder, int ServiceId, c
|
|||||||
cMutexLock MutexLock(&caDescriptorsMutex);
|
cMutexLock MutexLock(&caDescriptorsMutex);
|
||||||
int length = 0;
|
int length = 0;
|
||||||
do {
|
do {
|
||||||
const cCaDescriptor *d = caDescriptors->Get(Source, Transponder, ServiceId, *CaSystemIds);
|
for (cCaDescriptor *d = caDescriptors.First(); d; d = caDescriptors.Next(d)) {
|
||||||
if (d) {
|
if (d->source == Source && d->transponder == Transponder && d->serviceId == ServiceId && d->caSystem == *CaSystemIds) {
|
||||||
if (length + d->Length() <= BufSize) {
|
if (length + d->Length() <= BufSize) {
|
||||||
memcpy(Data + length, d->Data(), d->Length());
|
memcpy(Data + length, d->Data(), d->Length());
|
||||||
length += d->Length();
|
length += d->Length();
|
||||||
@ -1465,6 +1454,7 @@ int cSIProcessor::GetCaDescriptors(int Source, int Transponder, int ServiceId, c
|
|||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} while (*++CaSystemIds);
|
} while (*++CaSystemIds);
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
7
eit.h
7
eit.h
@ -16,7 +16,7 @@
|
|||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
* $Id: eit.h 1.27 2003/04/18 11:30:42 kls Exp $
|
* $Id: eit.h 1.28 2003/04/21 13:22:06 kls Exp $
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef __EIT_H
|
#ifndef __EIT_H
|
||||||
@ -135,14 +135,13 @@ typedef struct sip_filter {
|
|||||||
}SIP_FILTER;
|
}SIP_FILTER;
|
||||||
|
|
||||||
class cCaDescriptor;
|
class cCaDescriptor;
|
||||||
class cCaDescriptors;
|
|
||||||
|
|
||||||
class cSIProcessor : public cThread {
|
class cSIProcessor : public cThread {
|
||||||
private:
|
private:
|
||||||
static int numSIProcessors;
|
static int numSIProcessors;
|
||||||
static cSchedules *schedules;
|
static cSchedules *schedules;
|
||||||
static cMutex schedulesMutex;
|
static cMutex schedulesMutex;
|
||||||
static cCaDescriptors *caDescriptors;
|
static cList<cCaDescriptor> caDescriptors;
|
||||||
static cMutex caDescriptorsMutex;
|
static cMutex caDescriptorsMutex;
|
||||||
static const char *epgDataFileName;
|
static const char *epgDataFileName;
|
||||||
static time_t lastDump;
|
static time_t lastDump;
|
||||||
@ -158,7 +157,7 @@ private:
|
|||||||
bool AddFilter(unsigned short pid, u_char tid, u_char mask = 0xFF);
|
bool AddFilter(unsigned short pid, u_char tid, u_char mask = 0xFF);
|
||||||
bool DelFilter(unsigned short pid, u_char tid);
|
bool DelFilter(unsigned short pid, u_char tid);
|
||||||
bool ShutDownFilters(void);
|
bool ShutDownFilters(void);
|
||||||
void NewCaDescriptor(struct Descriptor *d, int ProgramID);
|
void NewCaDescriptor(struct Descriptor *d, int ServiceId);
|
||||||
public:
|
public:
|
||||||
cSIProcessor(const char *FileName);
|
cSIProcessor(const char *FileName);
|
||||||
~cSIProcessor();
|
~cSIProcessor();
|
||||||
|
Loading…
Reference in New Issue
Block a user