2003-12-22 13:29:24 +01:00
|
|
|
/*
|
|
|
|
* pat.c: PAT section filter
|
|
|
|
*
|
|
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
|
|
* how to reach the author.
|
|
|
|
*
|
2005-09-04 14:48:39 +02:00
|
|
|
* $Id: pat.c 1.14 2005/09/04 14:32:39 kls Exp $
|
2003-12-22 13:29:24 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "pat.h"
|
|
|
|
#include <malloc.h>
|
2004-01-04 12:30:00 +01:00
|
|
|
#include "channels.h"
|
2003-12-22 13:29:24 +01:00
|
|
|
#include "libsi/section.h"
|
|
|
|
#include "libsi/descriptor.h"
|
2004-01-04 12:30:00 +01:00
|
|
|
#include "thread.h"
|
2003-12-22 13:29:24 +01:00
|
|
|
|
|
|
|
#define PMT_SCAN_TIMEOUT 10 // seconds
|
|
|
|
|
|
|
|
// --- cCaDescriptor ---------------------------------------------------------
|
|
|
|
|
|
|
|
class cCaDescriptor : public cListObject {
|
|
|
|
private:
|
|
|
|
int caSystem;
|
2003-12-24 10:30:35 +01:00
|
|
|
bool stream;
|
2003-12-22 13:29:24 +01:00
|
|
|
int length;
|
|
|
|
uchar *data;
|
|
|
|
public:
|
2004-01-04 12:30:00 +01:00
|
|
|
cCaDescriptor(int CaSystem, int CaPid, bool Stream, int Length, const uchar *Data);
|
2003-12-22 13:29:24 +01:00
|
|
|
virtual ~cCaDescriptor();
|
2004-01-04 12:30:00 +01:00
|
|
|
bool operator== (const cCaDescriptor &arg) const;
|
|
|
|
int CaSystem(void) { return caSystem; }
|
|
|
|
int Stream(void) { return stream; }
|
2003-12-22 13:29:24 +01:00
|
|
|
int Length(void) const { return length; }
|
|
|
|
const uchar *Data(void) const { return data; }
|
|
|
|
};
|
|
|
|
|
2004-01-04 12:30:00 +01:00
|
|
|
cCaDescriptor::cCaDescriptor(int CaSystem, int CaPid, bool Stream, int Length, const uchar *Data)
|
2003-12-22 13:29:24 +01:00
|
|
|
{
|
|
|
|
caSystem = CaSystem;
|
2003-12-24 10:30:35 +01:00
|
|
|
stream = Stream;
|
2003-12-22 13:29:24 +01:00
|
|
|
length = Length + 6;
|
|
|
|
data = MALLOC(uchar, length);
|
|
|
|
data[0] = SI::CaDescriptorTag;
|
|
|
|
data[1] = length - 2;
|
|
|
|
data[2] = (caSystem >> 8) & 0xFF;
|
|
|
|
data[3] = caSystem & 0xFF;
|
|
|
|
data[4] = ((CaPid >> 8) & 0x1F) | 0xE0;
|
|
|
|
data[5] = CaPid & 0xFF;
|
|
|
|
if (Length)
|
|
|
|
memcpy(&data[6], Data, Length);
|
|
|
|
}
|
|
|
|
|
|
|
|
cCaDescriptor::~cCaDescriptor()
|
|
|
|
{
|
|
|
|
free(data);
|
|
|
|
}
|
|
|
|
|
2004-01-04 12:30:00 +01:00
|
|
|
bool cCaDescriptor::operator== (const cCaDescriptor &arg) const
|
|
|
|
{
|
|
|
|
return length == arg.length && memcmp(data, arg.data, length) == 0;
|
|
|
|
}
|
|
|
|
|
2003-12-22 13:29:24 +01:00
|
|
|
// --- cCaDescriptors --------------------------------------------------------
|
|
|
|
|
2004-01-04 12:30:00 +01:00
|
|
|
class cCaDescriptors : public cListObject {
|
2003-12-22 13:29:24 +01:00
|
|
|
private:
|
2004-01-04 12:30:00 +01:00
|
|
|
int source;
|
|
|
|
int transponder;
|
|
|
|
int serviceId;
|
|
|
|
int numCaIds;
|
|
|
|
int caIds[MAXCAIDS + 1];
|
|
|
|
cList<cCaDescriptor> caDescriptors;
|
|
|
|
void AddCaId(int CaId);
|
2003-12-22 13:29:24 +01:00
|
|
|
public:
|
2004-01-04 12:30:00 +01:00
|
|
|
cCaDescriptors(int Source, int Transponder, int ServiceId);
|
|
|
|
bool operator== (const cCaDescriptors &arg) const;
|
|
|
|
bool Is(int Source, int Transponder, int ServiceId);
|
|
|
|
bool Is(cCaDescriptors * CaDescriptors);
|
|
|
|
bool Empty(void) { return caDescriptors.Count() == 0; }
|
|
|
|
void AddCaDescriptor(SI::CaDescriptor *d, bool Stream);
|
|
|
|
int GetCaDescriptors(const unsigned short *CaSystemIds, int BufSize, uchar *Data, bool &StreamFlag);
|
|
|
|
const int *CaIds(void) { return caIds; }
|
2003-12-22 13:29:24 +01:00
|
|
|
};
|
|
|
|
|
2004-01-04 12:30:00 +01:00
|
|
|
cCaDescriptors::cCaDescriptors(int Source, int Transponder, int ServiceId)
|
|
|
|
{
|
|
|
|
source = Source;
|
|
|
|
transponder = Transponder;
|
|
|
|
serviceId = ServiceId;
|
|
|
|
numCaIds = 0;
|
|
|
|
caIds[0] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cCaDescriptors::operator== (const cCaDescriptors &arg) const
|
|
|
|
{
|
|
|
|
cCaDescriptor *ca1 = caDescriptors.First();
|
|
|
|
cCaDescriptor *ca2 = arg.caDescriptors.First();
|
|
|
|
while (ca1 && ca2) {
|
|
|
|
if (!(*ca1 == *ca2))
|
|
|
|
return false;
|
|
|
|
ca1 = caDescriptors.Next(ca1);
|
|
|
|
ca2 = arg.caDescriptors.Next(ca2);
|
|
|
|
}
|
|
|
|
return !ca1 && !ca2;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cCaDescriptors::Is(int Source, int Transponder, int ServiceId)
|
|
|
|
{
|
|
|
|
return source == Source && transponder == Transponder && serviceId == ServiceId;
|
|
|
|
}
|
|
|
|
|
2004-01-25 15:32:08 +01:00
|
|
|
bool cCaDescriptors::Is(cCaDescriptors *CaDescriptors)
|
2004-01-04 12:30:00 +01:00
|
|
|
{
|
|
|
|
return Is(CaDescriptors->source, CaDescriptors->transponder, CaDescriptors->serviceId);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cCaDescriptors::AddCaId(int CaId)
|
|
|
|
{
|
|
|
|
if (numCaIds < MAXCAIDS) {
|
|
|
|
for (int i = 0; i < numCaIds; i++) {
|
|
|
|
if (caIds[i] == CaId)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
caIds[numCaIds++] = CaId;
|
|
|
|
caIds[numCaIds] = 0;
|
2003-12-22 13:29:24 +01:00
|
|
|
}
|
2004-01-04 12:30:00 +01:00
|
|
|
}
|
2003-12-22 13:29:24 +01:00
|
|
|
|
2004-01-04 12:30:00 +01:00
|
|
|
void cCaDescriptors::AddCaDescriptor(SI::CaDescriptor *d, bool Stream)
|
|
|
|
{
|
|
|
|
cCaDescriptor *nca = new cCaDescriptor(d->getCaType(), d->getCaPid(), Stream, d->privateData.getLength(), d->privateData.getData());
|
|
|
|
for (cCaDescriptor *ca = caDescriptors.First(); ca; ca = caDescriptors.Next(ca)) {
|
|
|
|
if (*ca == *nca) {
|
|
|
|
delete nca;
|
2003-12-22 13:29:24 +01:00
|
|
|
return;
|
2004-01-04 12:30:00 +01:00
|
|
|
}
|
2003-12-22 13:29:24 +01:00
|
|
|
}
|
2004-01-04 12:30:00 +01:00
|
|
|
AddCaId(nca->CaSystem());
|
|
|
|
caDescriptors.Add(nca);
|
|
|
|
//#define DEBUG_CA_DESCRIPTORS 1
|
|
|
|
#ifdef DEBUG_CA_DESCRIPTORS
|
|
|
|
char buffer[1024];
|
|
|
|
char *q = buffer;
|
|
|
|
q += sprintf(q, "CAM: %04X %5d %5d %04X %d -", source, transponder, serviceId, d->getCaType(), Stream);
|
|
|
|
for (int i = 0; i < nca->Length(); i++)
|
|
|
|
q += sprintf(q, " %02X", nca->Data()[i]);
|
|
|
|
dsyslog(buffer);
|
|
|
|
#endif
|
2003-12-22 13:29:24 +01:00
|
|
|
}
|
|
|
|
|
2004-01-04 12:30:00 +01:00
|
|
|
int cCaDescriptors::GetCaDescriptors(const unsigned short *CaSystemIds, int BufSize, uchar *Data, bool &StreamFlag)
|
2003-12-22 13:29:24 +01:00
|
|
|
{
|
|
|
|
if (!CaSystemIds || !*CaSystemIds)
|
|
|
|
return 0;
|
|
|
|
if (BufSize > 0 && Data) {
|
|
|
|
int length = 0;
|
2003-12-24 10:30:35 +01:00
|
|
|
int IsStream = -1;
|
2004-01-04 12:30:00 +01:00
|
|
|
for (cCaDescriptor *d = caDescriptors.First(); d; d = caDescriptors.Next(d)) {
|
|
|
|
const unsigned short *caids = CaSystemIds;
|
|
|
|
do {
|
|
|
|
if (d->CaSystem() == *caids) {
|
|
|
|
if (length + d->Length() <= BufSize) {
|
|
|
|
if (IsStream >= 0 && IsStream != d->Stream())
|
|
|
|
dsyslog("CAM: different stream flag in CA descriptors");
|
|
|
|
IsStream = d->Stream();
|
|
|
|
memcpy(Data + length, d->Data(), d->Length());
|
|
|
|
length += d->Length();
|
2003-12-22 13:29:24 +01:00
|
|
|
}
|
2004-01-04 12:30:00 +01:00
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
} while (*++caids);
|
2003-12-22 13:29:24 +01:00
|
|
|
}
|
2003-12-24 10:30:35 +01:00
|
|
|
StreamFlag = IsStream == 1;
|
2003-12-22 13:29:24 +01:00
|
|
|
return length;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2004-01-04 12:30:00 +01:00
|
|
|
// --- cCaDescriptorHandler --------------------------------------------------
|
|
|
|
|
|
|
|
class cCaDescriptorHandler : public cList<cCaDescriptors> {
|
|
|
|
private:
|
|
|
|
cMutex mutex;
|
|
|
|
public:
|
|
|
|
int AddCaDescriptors(cCaDescriptors *CaDescriptors);
|
|
|
|
// Returns 0 if this is an already known descriptor,
|
|
|
|
// 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 unsigned short *CaSystemIds, int BufSize, uchar *Data, bool &StreamFlag);
|
|
|
|
};
|
|
|
|
|
|
|
|
int cCaDescriptorHandler::AddCaDescriptors(cCaDescriptors *CaDescriptors)
|
|
|
|
{
|
|
|
|
cMutexLock MutexLock(&mutex);
|
|
|
|
for (cCaDescriptors *ca = First(); ca; ca = Next(ca)) {
|
|
|
|
if (ca->Is(CaDescriptors)) {
|
|
|
|
if (*ca == *CaDescriptors) {
|
|
|
|
delete CaDescriptors;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
Del(ca);
|
|
|
|
Add(CaDescriptors);
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Add(CaDescriptors);
|
|
|
|
return CaDescriptors->Empty() ? 0 : 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int cCaDescriptorHandler::GetCaDescriptors(int Source, int Transponder, int ServiceId, const unsigned short *CaSystemIds, int BufSize, uchar *Data, bool &StreamFlag)
|
|
|
|
{
|
|
|
|
cMutexLock MutexLock(&mutex);
|
2004-05-23 09:29:59 +02:00
|
|
|
StreamFlag = false;
|
2004-01-04 12:30:00 +01:00
|
|
|
for (cCaDescriptors *ca = First(); ca; ca = Next(ca)) {
|
|
|
|
if (ca->Is(Source, Transponder, ServiceId))
|
|
|
|
return ca->GetCaDescriptors(CaSystemIds, BufSize, Data, StreamFlag);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
cCaDescriptorHandler CaDescriptorHandler;
|
2003-12-22 13:29:24 +01:00
|
|
|
|
2003-12-24 10:30:35 +01:00
|
|
|
int GetCaDescriptors(int Source, int Transponder, int ServiceId, const unsigned short *CaSystemIds, int BufSize, uchar *Data, bool &StreamFlag)
|
2003-12-22 13:29:24 +01:00
|
|
|
{
|
2004-01-04 12:30:00 +01:00
|
|
|
return CaDescriptorHandler.GetCaDescriptors(Source, Transponder, ServiceId, CaSystemIds, BufSize, Data, StreamFlag);
|
2003-12-22 13:29:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// --- cPatFilter ------------------------------------------------------------
|
|
|
|
|
|
|
|
cPatFilter::cPatFilter(void)
|
|
|
|
{
|
|
|
|
pmtIndex = 0;
|
|
|
|
pmtPid = 0;
|
|
|
|
lastPmtScan = 0;
|
2004-01-04 12:30:00 +01:00
|
|
|
numPmtEntries = 0;
|
2003-12-22 13:29:24 +01:00
|
|
|
Set(0x00, 0x00); // PAT
|
|
|
|
}
|
|
|
|
|
|
|
|
void cPatFilter::SetStatus(bool On)
|
|
|
|
{
|
|
|
|
cFilter::SetStatus(On);
|
|
|
|
pmtIndex = 0;
|
|
|
|
pmtPid = 0;
|
|
|
|
lastPmtScan = 0;
|
2004-01-04 12:30:00 +01:00
|
|
|
numPmtEntries = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cPatFilter::Trigger(void)
|
|
|
|
{
|
|
|
|
numPmtEntries = 0;
|
|
|
|
}
|
|
|
|
|
2004-03-13 10:35:38 +01:00
|
|
|
bool cPatFilter::PmtVersionChanged(int PmtPid, int Sid, int Version)
|
2004-01-04 12:30:00 +01:00
|
|
|
{
|
2004-03-13 10:35:38 +01:00
|
|
|
uint64_t v = Version;
|
|
|
|
v <<= 32;
|
|
|
|
uint64_t id = (PmtPid | (Sid << 16)) & 0x00000000FFFFFFFFLL;
|
2004-01-04 12:30:00 +01:00
|
|
|
for (int i = 0; i < numPmtEntries; i++) {
|
2004-03-13 10:35:38 +01:00
|
|
|
if ((pmtVersion[i] & 0x00000000FFFFFFFFLL) == id) {
|
|
|
|
bool Changed = (pmtVersion[i] & 0x000000FF00000000LL) != v;
|
2004-01-04 12:30:00 +01:00
|
|
|
if (Changed)
|
2004-03-13 10:35:38 +01:00
|
|
|
pmtVersion[i] = id | v;
|
2004-01-04 12:30:00 +01:00
|
|
|
return Changed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (numPmtEntries < MAXPMTENTRIES)
|
2004-03-13 10:35:38 +01:00
|
|
|
pmtVersion[numPmtEntries++] = id | v;
|
2004-01-04 12:30:00 +01:00
|
|
|
return true;
|
2003-12-22 13:29:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
|
|
|
|
{
|
|
|
|
if (Pid == 0x00) {
|
|
|
|
if (Tid == 0x00) {
|
|
|
|
if (pmtPid && time(NULL) - lastPmtScan > PMT_SCAN_TIMEOUT) {
|
|
|
|
Del(pmtPid, 0x02);
|
|
|
|
pmtPid = 0;
|
|
|
|
pmtIndex++;
|
|
|
|
lastPmtScan = time(NULL);
|
|
|
|
}
|
|
|
|
if (!pmtPid) {
|
|
|
|
SI::PAT pat(Data, false);
|
|
|
|
if (!pat.CheckCRCAndParse())
|
|
|
|
return;
|
|
|
|
SI::PAT::Association assoc;
|
|
|
|
int Index = 0;
|
2004-10-16 10:14:19 +02:00
|
|
|
for (SI::Loop::Iterator it; pat.associationLoop.getNext(assoc, it); ) {
|
2003-12-22 13:29:24 +01:00
|
|
|
if (!assoc.isNITPid()) {
|
|
|
|
if (Index++ == pmtIndex) {
|
|
|
|
pmtPid = assoc.getPid();
|
|
|
|
Add(pmtPid, 0x02);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!pmtPid)
|
|
|
|
pmtIndex = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (Pid == pmtPid && Tid == SI::TableIdPMT && Source() && Transponder()) {
|
|
|
|
SI::PMT pmt(Data, false);
|
|
|
|
if (!pmt.CheckCRCAndParse())
|
|
|
|
return;
|
2004-03-13 10:35:38 +01:00
|
|
|
if (!PmtVersionChanged(pmtPid, pmt.getTableIdExtension(), pmt.getVersionNumber())) {
|
2004-01-04 12:30:00 +01:00
|
|
|
lastPmtScan = 0; // this triggers the next scan
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!Channels.Lock(true, 10)) {
|
|
|
|
numPmtEntries = 0; // to make sure we try again
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
cChannel *Channel = Channels.GetByServiceID(Source(), Transponder(), pmt.getServiceId());
|
|
|
|
if (Channel) {
|
|
|
|
SI::CaDescriptor *d;
|
|
|
|
cCaDescriptors *CaDescriptors = new cCaDescriptors(Channel->Source(), Channel->Transponder(), Channel->Sid());
|
|
|
|
// Scan the common loop:
|
|
|
|
for (SI::Loop::Iterator it; (d = (SI::CaDescriptor*)pmt.commonDescriptors.getNext(it, SI::CaDescriptorTag)); ) {
|
|
|
|
CaDescriptors->AddCaDescriptor(d, false);
|
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
// Scan the stream-specific loop:
|
|
|
|
SI::PMT::Stream stream;
|
|
|
|
int Vpid = 0;
|
|
|
|
int Ppid = pmt.getPCRPid();
|
2005-08-06 12:29:38 +02:00
|
|
|
int Apids[MAXAPIDS + 1] = { 0 }; // these lists are zero-terminated
|
2005-01-30 12:11:56 +01:00
|
|
|
int Dpids[MAXDPIDS + 1] = { 0 };
|
2005-09-04 14:48:39 +02:00
|
|
|
char ALangs[MAXAPIDS][MAXLANGCODE2] = { "" };
|
|
|
|
char DLangs[MAXDPIDS][MAXLANGCODE2] = { "" };
|
2004-01-04 12:30:00 +01:00
|
|
|
int Tpid = 0;
|
|
|
|
int NumApids = 0;
|
|
|
|
int NumDpids = 0;
|
2004-10-16 10:14:19 +02:00
|
|
|
for (SI::Loop::Iterator it; pmt.streamLoop.getNext(stream, it); ) {
|
2004-01-04 12:30:00 +01:00
|
|
|
switch (stream.getStreamType()) {
|
|
|
|
case 1: // STREAMTYPE_11172_VIDEO
|
|
|
|
case 2: // STREAMTYPE_13818_VIDEO
|
|
|
|
Vpid = stream.getPid();
|
|
|
|
break;
|
|
|
|
case 3: // STREAMTYPE_11172_AUDIO
|
|
|
|
case 4: // STREAMTYPE_13818_AUDIO
|
|
|
|
{
|
2004-01-25 15:32:08 +01:00
|
|
|
if (NumApids < MAXAPIDS) {
|
|
|
|
Apids[NumApids] = stream.getPid();
|
|
|
|
SI::Descriptor *d;
|
|
|
|
for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) {
|
|
|
|
switch (d->getDescriptorTag()) {
|
|
|
|
case SI::ISO639LanguageDescriptorTag: {
|
|
|
|
SI::ISO639LanguageDescriptor *ld = (SI::ISO639LanguageDescriptor *)d;
|
2005-09-04 14:48:39 +02:00
|
|
|
SI::ISO639LanguageDescriptor::Language l;
|
|
|
|
char *s = ALangs[NumApids];
|
|
|
|
int n = 0;
|
|
|
|
for (SI::Loop::Iterator it; ld->languageLoop.getNext(l, it); ) {
|
|
|
|
if (*ld->languageCode != '-') { // some use "---" to indicate "none"
|
|
|
|
if (n > 0)
|
|
|
|
*s++ = '+';
|
|
|
|
strn0cpy(s, I18nNormalizeLanguageCode(l.languageCode), MAXLANGCODE1);
|
|
|
|
s += strlen(s);
|
|
|
|
if (n++ > 1)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-01-25 15:32:08 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default: ;
|
|
|
|
}
|
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
NumApids++;
|
|
|
|
}
|
2004-01-04 12:30:00 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 5: // STREAMTYPE_13818_PRIVATE
|
|
|
|
case 6: // STREAMTYPE_13818_PES_PRIVATE
|
|
|
|
//XXX case 8: // STREAMTYPE_13818_DSMCC
|
|
|
|
{
|
2004-01-25 15:32:08 +01:00
|
|
|
int dpid = 0;
|
2005-09-04 14:48:39 +02:00
|
|
|
char lang[MAXLANGCODE1] = { 0 };
|
2004-01-04 12:30:00 +01:00
|
|
|
SI::Descriptor *d;
|
|
|
|
for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) {
|
|
|
|
switch (d->getDescriptorTag()) {
|
|
|
|
case SI::AC3DescriptorTag:
|
2004-01-25 15:32:08 +01:00
|
|
|
dpid = stream.getPid();
|
2004-01-04 12:30:00 +01:00
|
|
|
break;
|
|
|
|
case SI::TeletextDescriptorTag:
|
|
|
|
Tpid = stream.getPid();
|
|
|
|
break;
|
2004-01-25 15:32:08 +01:00
|
|
|
case SI::ISO639LanguageDescriptorTag: {
|
|
|
|
SI::ISO639LanguageDescriptor *ld = (SI::ISO639LanguageDescriptor *)d;
|
2005-09-04 14:48:39 +02:00
|
|
|
strn0cpy(lang, I18nNormalizeLanguageCode(ld->languageCode), MAXLANGCODE1);
|
2004-01-25 15:32:08 +01:00
|
|
|
}
|
|
|
|
break;
|
2004-01-04 12:30:00 +01:00
|
|
|
default: ;
|
|
|
|
}
|
|
|
|
delete d;
|
|
|
|
}
|
2004-01-25 15:32:08 +01:00
|
|
|
if (dpid) {
|
2005-01-16 14:40:47 +01:00
|
|
|
if (NumDpids < MAXDPIDS) {
|
2004-01-25 15:32:08 +01:00
|
|
|
Dpids[NumDpids] = dpid;
|
2005-09-04 14:48:39 +02:00
|
|
|
strn0cpy(DLangs[NumDpids], lang, MAXLANGCODE1);
|
2004-01-25 15:32:08 +01:00
|
|
|
NumDpids++;
|
|
|
|
}
|
|
|
|
}
|
2004-01-04 12:30:00 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
//default: printf("PID: %5d %5d %2d %3d %3d\n", pmt.getServiceId(), stream.getPid(), stream.getStreamType(), pmt.getVersionNumber(), Channel->Number());//XXX
|
|
|
|
}
|
|
|
|
for (SI::Loop::Iterator it; (d = (SI::CaDescriptor*)stream.streamDescriptors.getNext(it, SI::CaDescriptorTag)); ) {
|
|
|
|
CaDescriptors->AddCaDescriptor(d, true);
|
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
}
|
2004-01-05 12:08:09 +01:00
|
|
|
if (Setup.UpdateChannels >= 2) {
|
2004-01-25 15:32:08 +01:00
|
|
|
Channel->SetPids(Vpid, Vpid ? Ppid : 0, Apids, ALangs, Dpids, DLangs, Tpid);
|
2004-01-05 12:08:09 +01:00
|
|
|
Channel->SetCaIds(CaDescriptors->CaIds());
|
|
|
|
}
|
2004-01-25 14:07:24 +01:00
|
|
|
Channel->SetCaDescriptors(CaDescriptorHandler.AddCaDescriptors(CaDescriptors));
|
2004-01-04 12:30:00 +01:00
|
|
|
}
|
2003-12-22 13:29:24 +01:00
|
|
|
lastPmtScan = 0; // this triggers the next scan
|
2004-01-04 12:30:00 +01:00
|
|
|
Channels.Unlock();
|
2003-12-22 13:29:24 +01:00
|
|
|
}
|
|
|
|
}
|