16 #define PMT_SCAN_TIMEOUT 1000
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)
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();
273 int GetCaPids(
int Source,
int Transponder,
int ServiceId,
const int *CaSystemIds,
int BufSize,
int *Pids)
278 int GetPmtPid(
int Source,
int Transponder,
int ServiceId)
335 #define DBGLOG(a...) { cString s = cString::sprintf(a); fprintf(stderr, "%s\n", *s); dsyslog("%s", *s); }
337 #define DBGLOG(a...) void()
349 DBGLOG(
"PAT filter set status %d", On);
364 DBGLOG(
"PAT filter trigger SID %d", Sid);
371 if (se->Pid() == PmtPid && !se->Received())
380 if (se->Pid() == PmtPid)
381 se->SetReceived(
false);
389 if (se->Sid() == Sid && se->Pid() == PmtPid) {
390 if (!se->Received()) {
391 se->SetReceived(
true);
394 if (se->Version() != Version) {
396 se->SetVersion(Version);
398 DBGLOG(
"PMT %d %2d %5d/%d %2d -> %2d",
Transponder(), i, PmtPid, Sid, se->Version(), Version);
443 int PmtPid = assoc.
getPid();
456 DBGLOG(
"sid = %d pidIndex = %d",
sid, PidIndex);
487 bool ChannelsModified =
false;
511 uint16_t CompositionPageIds[
MAXSPIDS + 1] = { 0 };
512 uint16_t AncillaryPageIds[
MAXSPIDS + 1] = { 0 };
521 bool ProcessCaDescriptors =
false;
522 int esPid = stream.
getPid();
531 ProcessCaDescriptors =
true;
539 Apids[NumApids] = esPid;
547 char *s = ALangs[NumApids];
567 ProcessCaDescriptors =
true;
584 ProcessCaDescriptors =
true;
588 Spids[NumSpids] = esPid;
591 char *s = SLangs[NumSpids];
623 Dpids[NumDpids] = dpid;
624 Dtypes[NumDpids] = dtype;
636 ProcessCaDescriptors =
true;
657 Dpids[NumDpids] = esPid;
662 ProcessCaDescriptors =
true;
704 Dpids[NumDpids] = esPid;
709 ProcessCaDescriptors =
true;
715 if (ProcessCaDescriptors) {
725 ChannelsModified |=
Channel->
SetPids(Vpid, Ppid, Vtype, Apids, Atypes, ALangs, Dpids, Dtypes, DLangs, Spids, SLangs, Tpid);
731 StateKey.
Remove(ChannelsModified);
const unsigned char * getData() const
Descriptor * getNext(Iterator &it)
DescriptorTag getDescriptorTag() const
StructureLoop< Language > languageLoop
int getTableIdExtension() const
int getSectionNumber() const
int getLastSectionNumber() const
int getVersionNumber() const
StructureLoop< Association > associationLoop
DescriptorLoop streamDescriptors
int getStreamType() const
StructureLoop< Stream > streamLoop
DescriptorLoop commonDescriptors
int getFormatIdentifier() const
int getSubtitlingType() const
int getAncillaryPageId() const
int getCompositionPageId() const
StructureLoop< Subtitling > subtitlingLoop
int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids)
int GetPmtPid(int Source, int Transponder, int ServiceId)
void GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid)
int AddCaDescriptors(cCaDescriptors *CaDescriptors)
const uchar * Data(void) const
cCaDescriptor(int CaSystem, int CaPid, int EsPid, int Length, const uchar *Data)
bool operator==(const cCaDescriptor &arg) const
cCaDescriptors(int Source, int Transponder, int ServiceId, int PmtPid)
const int GetPmtPid(void)
bool Is(int Source, int Transponder, int ServiceId)
cList< cCaDescriptor > caDescriptors
void AddCaDescriptor(SI::CaDescriptor *d, int EsPid)
int GetCaPids(const int *CaSystemIds, int BufSize, int *Pids)
bool operator==(const cCaDescriptors &arg) const
void GetCaDescriptors(const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid)
bool SetCaIds(const int *CaIds)
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)
bool ClearObsoleteChannel(void)
bool SetCaDescriptors(int Level)
int Transponder(void) const
Returns the transponder frequency in MHz, plus the polarization in case of sat.
bool SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *CompositionPageIds, uint16_t *AncillaryPageIds)
static cChannels * GetChannelsWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of channels for write access.
const cChannel * GetByServiceID(int Source, int Transponder, unsigned short ServiceID) const
void Append(const uchar *Data, int Length)
void Set(u_short Pid, u_char Tid, u_char Mask=0xFF)
Sets the given filter data by calling Add() with Sticky = true.
int Transponder(void)
Returns the transponder of the data delivered to this filter.
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
int Source(void)
Returns the source of the data delivered to this filter.
const cChannel * Channel(void)
Returns the channel of the data delivered to this filter.
void Del(u_short Pid, u_char Tid, u_char Mask=0xFF)
Deletes the given filter data from this filter.
void Add(u_short Pid, u_char Tid, u_char Mask=0xFF, bool Sticky=false)
Adds the given filter data to this filter.
void Del(cListObject *Object, bool DeleteObject=true)
void Add(cListObject *Object, cListObject *After=NULL)
const T * Next(const T *Object) const
< Returns the element immediately before Object in this list, or NULL if Object is the first element ...
const T * First(void) const
Returns the first element in this list, or NULL if the list is empty.
cList< cPmtSidEntry > pmtSidList
void PmtPidReset(int PmtPid)
bool PmtPidComplete(int PmtPid)
void SwitchToNextPmtPid(void)
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
bool PmtVersionChanged(int PmtPid, int Sid, int Version, bool SetNewVersion=false)
cList< cPmtPidEntry > pmtPidList
cSectionSyncer sectionSyncer
virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
Processes the data delivered to this filter.
void SetComplete(bool State)
void SetReceived(bool State)
cPmtSidEntry(int Sid, int Pid, cPmtPidEntry *PidEntry)
void SetVersion(int Version)
cPmtPidEntry * PidEntry(void)
bool Sync(uchar Version, int Number, int LastNumber)
void Remove(bool IncState=true)
Removes this key from the lock it was previously used with.
void Set(int Ms=0)
Sets the timer.
bool TimedOut(void) const
#define STANDARD_ANSISCTE
const char * I18nNormalizeLanguageCode(const char *Code)
Returns a 3 letter language code that may not be zero terminated.
@ EnhancedAC3DescriptorTag
@ SubtitlingDescriptorTag
@ ISO639LanguageDescriptorTag
@ RegistrationDescriptorTag
int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids)
Gets all CA pids for a given channel.
int GetPmtPid(int Source, int Transponder, int ServiceId)
Gets the Pid of the PMT in which the CA descriptors for this channel are defined.
void GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid)
Gets all CA descriptors for a given channel.
cCaDescriptorHandler CaDescriptorHandler