16 #define PMT_SCAN_TIMEOUT 1000 // ms
49 data[4] = ((CaPid >> 8) & 0x1F) | 0xE0;
50 data[5] = CaPid & 0xFF;
52 memcpy(&
data[6], Data, Length);
78 cCaDescriptors(
int Source,
int Transponder,
int ServiceId,
int PmtPid);
80 bool Is(
int Source,
int Transponder,
int ServiceId);
85 int GetCaPids(
const int *CaSystemIds,
int BufSize,
int *Pids);
126 for (
int i = 0; i <
numCaIds; i++) {
127 if (
caIds[i] == CaId)
130 caIds[numCaIds++] = CaId;
147 #ifdef DEBUG_CA_DESCRIPTORS
151 for (
int i = 0; i < nca->
Length(); i++)
152 q += sprintf(q,
" %02X", nca->
Data()[i]);
165 if (!CaSystemIds || !*CaSystemIds)
168 if (EsPid < 0 || d->EsPid() == EsPid) {
169 const int *caids = CaSystemIds;
171 if (*caids == 0xFFFF || d->CaSystem() == *caids)
172 Buffer.
Append(d->Data(), d->Length());
180 if (!CaSystemIds || !*CaSystemIds)
182 if (BufSize > 0 && Pids) {
185 const int *caids = CaSystemIds;
187 if (*caids == 0xFFFF || d->CaSystem() == *caids) {
188 if (numPids + 1 < BufSize) {
189 Pids[numPids++] = d->CaPid();
213 int GetCaPids(
int Source,
int Transponder,
int ServiceId,
const int *CaSystemIds,
int BufSize,
int *Pids);
214 int GetPmtPid(
int Source,
int Transponder,
int ServiceId);
221 if (ca->Is(CaDescriptors)) {
222 if (*ca == *CaDescriptors) {
223 delete CaDescriptors;
232 return CaDescriptors->
Empty() ? 0 : 1;
239 if (ca->Is(Source, Transponder, ServiceId)) {
240 ca->GetCaDescriptors(CaSystemIds, Buffer, EsPid);
250 if (ca->Is(Source, Transponder, ServiceId))
251 return ca->GetCaPids(CaSystemIds, BufSize, Pids);
260 if (ca->Is(Source, Transponder, ServiceId))
261 return ca->GetPmtPid();
270 CaDescriptorHandler.
GetCaDescriptors(Source, Transponder, ServiceId, CaSystemIds, Buffer, EsPid);
273 int GetCaPids(
int Source,
int Transponder,
int ServiceId,
const int *CaSystemIds,
int BufSize,
int *Pids)
275 return CaDescriptorHandler.
GetCaPids(Source, Transponder, ServiceId, CaSystemIds, BufSize, Pids);
278 int GetPmtPid(
int Source,
int Transponder,
int ServiceId)
280 return CaDescriptorHandler.
GetPmtPid(Source, Transponder, ServiceId);
287 #define DBGLOG(a...) { cString s = cString::sprintf(a); fprintf(stderr, "%s\n", *s); dsyslog("%s", *s); }
301 DBGLOG(
"PAT filter set status %d", On);
314 DBGLOG(
"PAT filter trigger SID %d", Sid);
322 if (
pmtId[i] == Id) {
394 bool ChannelsModified =
false;
417 uint16_t CompositionPageIds[
MAXSPIDS + 1] = { 0 };
418 uint16_t AncillaryPageIds[
MAXSPIDS + 1] = { 0 };
427 bool ProcessCaDescriptors =
false;
428 int esPid = stream.
getPid();
437 ProcessCaDescriptors =
true;
445 Apids[NumApids] = esPid;
453 char *s = ALangs[NumApids];
473 ProcessCaDescriptors =
true;
490 ProcessCaDescriptors =
true;
494 Spids[NumSpids] = esPid;
497 char *s = SLangs[NumSpids];
529 Dpids[NumDpids] = dpid;
530 Dtypes[NumDpids] = dtype;
542 ProcessCaDescriptors =
true;
562 Dpids[NumDpids] = esPid;
567 ProcessCaDescriptors =
true;
608 Dpids[NumDpids] = esPid;
613 ProcessCaDescriptors =
true;
619 if (ProcessCaDescriptors) {
627 ChannelsModified |= Channel->
SetPids(Vpid, Ppid, Vtype, Apids, Atypes, ALangs, Dpids, Dtypes, DLangs, Spids, SLangs, Tpid);
628 ChannelsModified |= Channel->
SetCaIds(CaDescriptors->
CaIds());
633 StateKey.
Remove(ChannelsModified);
#define STANDARD_ANSISCTE
void GetCaDescriptors(const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid)
bool SetPids(int Vpid, int Ppid, int Vtype, int *Apids, int *Atypes, char ALangs[][MAXLANGCODE2], int *Dpids, int *Dtypes, char DLangs[][MAXLANGCODE2], int *Spids, char SLangs[][MAXLANGCODE2], int Tpid)
virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
Processes the data delivered to this filter.
void Add(cListObject *Object, cListObject *After=NULL)
int getCompositionPageId() const
StructureLoop< Association > associationLoop
void Remove(bool IncState=true)
Removes this key from the lock it was previously used with.
StructureLoop< Stream > streamLoop
void Add(u_short Pid, u_char Tid, u_char Mask=0xFF, bool Sticky=false)
Adds the given filter data to this filter.
const cChannel * Channel(void)
Returns the channel of the data delivered to this filter.
DescriptorLoop commonDescriptors
const cChannel * GetByServiceID(int Source, int Transponder, unsigned short ServiceID) const
DescriptorTag getDescriptorTag() const
StructureLoop< Subtitling > subtitlingLoop
void AddCaDescriptor(SI::CaDescriptor *d, int EsPid)
int Transponder(void) const
Returns the transponder frequency in MHz, plus the polarization in case of sat.
int GetPmtPid(int Source, int Transponder, int ServiceId)
cCaDescriptors(int Source, int Transponder, int ServiceId, int PmtPid)
int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids)
void GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid)
static cChannels * GetChannelsWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of channels for write access.
void GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid)
Gets all CA descriptors for a given channel.
void Del(u_short Pid, u_char Tid, u_char Mask=0xFF)
Deletes the given filter data from this filter.
int getTableIdExtension() const
int Source(void)
Returns the source of the data delivered to this filter.
bool TimedOut(void) const
bool Is(int Source, int Transponder, int ServiceId)
int getFormatIdentifier() const
void SwitchToNextPmtPid(void)
int GetPmtPid(int Source, int Transponder, int ServiceId)
Gets the Pid of the PMT in which the CA descriptors for this channel are defined. ...
const T * Next(const T *Object) const
< Returns the element immediately before Object in this list, or NULL if Object is the first element ...
int getSubtitlingType() const
StructureLoop< Language > languageLoop
int GetCaPids(const int *CaSystemIds, int BufSize, int *Pids)
int MakePmtId(int PmtPid, int Sid)
int AddCaDescriptors(cCaDescriptors *CaDescriptors)
const int GetPmtPid(void)
bool SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *CompositionPageIds, uint16_t *AncillaryPageIds)
int getStreamType() const
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
void Del(cListObject *Object, bool DeleteObject=true)
cList< cCaDescriptor > caDescriptors
int getVersionNumber() const
bool operator==(const cCaDescriptors &arg) const
DescriptorLoop streamDescriptors
void Append(const uchar *Data, int Length)
int Transponder(void)
Returns the transponder of the data delivered to this filter.
void Set(u_short Pid, u_char Tid, u_char Mask=0xFF)
Sets the given filter data by calling Add() with Sticky = true.
int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids)
Gets all CA pids for a given channel.
const uchar * Data(void) const
cCaDescriptor(int CaSystem, int CaPid, int EsPid, int Length, const uchar *Data)
int pmtVersion[MAXPMTENTRIES]
const T * First(void) const
Returns the first element in this list, or NULL if the list is empty.
int getAncillaryPageId() const
bool SetCaIds(const int *CaIds)
bool PmtVersionChanged(int PmtPid, int Sid, int Version, bool SetNewVersion=false)
bool operator==(const cCaDescriptor &arg) const
const char * I18nNormalizeLanguageCode(const char *Code)
Returns a 3 letter language code that may not be zero terminated.
const unsigned char * getData() const
Descriptor * getNext(Iterator &it)
cCaDescriptorHandler CaDescriptorHandler
bool SetCaDescriptors(int Level)