Go to the documentation of this file.
16 #define PMT_SCAN_TIMEOUT 1000 // ms
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)
360 #define DBGLOG(a...) { cString s = cString::sprintf(a); fprintf(stderr, "%s\n", *s); dsyslog("%s", *s); }
362 #define DBGLOG(a...) void()
379 pPid->SetState(pPid->Count() > 0);
385 DBGLOG(
"PAT filter set status %d", On);
403 DBGLOG(
"PAT filter trigger");
411 DBGLOG(
"PAT filter request SID %d", Sid);
413 if (sr->Sid() == Sid) {
415 DBGLOG(
"PAT filter add SID request %d (%d)", Sid, sr->Count());
419 DBGLOG(
"PAT filter new SID request %d", Sid);
422 if (se->Sid() == Sid) {
425 DBGLOG(
" PMT pid %5d SID %5d (%d)", pPid->
Pid(), se->Sid(), pPid->
Count());
434 DBGLOG(
"PAT filter release SID %d", Sid);
436 if (sr->Sid() == Sid) {
438 DBGLOG(
"PAT filter del SID request %d (%d)", Sid, sr->Count());
439 if (sr->Count() == 0) {
442 if (se->Sid() == Sid) {
445 DBGLOG(
" PMT pid %5d SID %5d (%d)", pPid->
Pid(), se->Sid(), pPid->
Count());
458 if (sr->Sid() == Sid)
467 if (se->Pid() == PmtPid && !se->Received())
476 if (se->Pid() == PmtPid) {
477 se->SetReceived(
false);
478 se->PidEntry()->SetComplete(
false);
486 if (se->Sid() == Sid && se->Pid() == PmtPid) {
487 if (!se->Received()) {
488 se->SetReceived(
true);
491 if (se->Version() != Version) {
493 se->SetVersion(Version);
531 int State = pPid->State();
538 else if (Pid != 0x00)
559 int PmtPid = assoc.
getPid();
563 if (pPid->
Pid() == PmtPid)
567 DBGLOG(
" PMT pid %5d SID %5d%s%s", PmtPid, PmtSid, SidRequest ?
" R" :
"", pPid ?
" S" :
"");
579 if (pPid->Count() == 0) {
606 bool ChannelsModified =
false;
630 uint16_t CompositionPageIds[
MAXSPIDS + 1] = { 0 };
631 uint16_t AncillaryPageIds[
MAXSPIDS + 1] = { 0 };
640 bool ProcessCaDescriptors =
false;
641 int esPid = stream.
getPid();
650 ProcessCaDescriptors =
true;
658 Apids[NumApids] = esPid;
666 char *s = ALangs[NumApids];
686 ProcessCaDescriptors =
true;
703 ProcessCaDescriptors =
true;
707 Spids[NumSpids] = esPid;
710 char *s = SLangs[NumSpids];
742 Dpids[NumDpids] = dpid;
743 Dtypes[NumDpids] = dtype;
755 ProcessCaDescriptors =
true;
776 Dpids[NumDpids] = esPid;
781 ProcessCaDescriptors =
true;
823 Dpids[NumDpids] = esPid;
828 ProcessCaDescriptors =
true;
834 if (ProcessCaDescriptors) {
844 ChannelsModified |=
Channel->
SetPids(Vpid, Ppid, Vtype, Apids, Atypes, ALangs, Dpids, Dtypes, DLangs, Spids, SLangs, Tpid);
850 StateKey.
Remove(ChannelsModified);
cList< cPmtPidEntry > pmtPidList
int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids)
Gets all CA pids for a given channel.
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
cList< cPmtSidRequest > pmtSidRequestList
const int GetPmtPid(void)
@ RegistrationDescriptorTag
int Transponder(void)
Returns the transponder of the data delivered to this filter.
void SetComplete(bool State)
int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids)
bool SetCaIds(const int *CaIds)
void Set(u_short Pid, u_char Tid, u_char Mask=0xFF)
Sets the given filter data by calling Add() with Sticky = true.
int getCompositionPageId() const
cCaDescriptors(int Source, int Transponder, int ServiceId, int PmtPid)
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)
const uchar * Data(void) const
int getStreamType() const
int getAncillaryPageId() const
int getFormatIdentifier() const
bool TransponderChanged(void)
void Add(cListObject *Object, cListObject *After=NULL)
void Del(u_short Pid, u_char Tid, u_char Mask=0xFF)
Deletes the given filter data from this filter.
int AddCaDescriptors(cCaDescriptors *CaDescriptors)
static cChannels * GetChannelsWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of channels for write access.
int getLastSectionNumber() const
StructureLoop< Stream > streamLoop
int getSectionNumber() const
void Set(int Ms=0)
Sets the timer.
int Transponder(void) const
Returns the transponder frequency in MHz, plus the polarization in case of sat.
bool PmtVersionChanged(int PmtPid, int Sid, int Version, bool SetNewVersion=false)
@ EnhancedAC3DescriptorTag
int getTableIdExtension() const
void Del(cListObject *Object, bool DeleteObject=true)
cList< cCaDescriptor > caDescriptors
bool PmtPidComplete(int PmtPid)
int getSubtitlingType() const
StructureLoop< Subtitling > subtitlingLoop
const unsigned char * getData() const
void GetCaDescriptors(const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid)
DescriptorTag getDescriptorTag() const
bool Is(int Source, int Transponder, int ServiceId)
@ ISO639LanguageDescriptorTag
void GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid)
Gets all CA descriptors for a given channel.
DescriptorLoop streamDescriptors
void Remove(bool IncState=true)
Removes this key from the lock it was previously used with.
const cChannel * Channel(void)
Returns the channel of the data delivered to this filter.
bool Processed(int SectionNumber, int LastSectionNumber, int SegmentLastSectionNumber=-1)
Marks the given SectionNumber as processed.
void GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid)
void SetVersion(int Version)
void SwitchToNextPmtPid(void)
int GetPmtPid(int Source, int Transponder, int ServiceId)
void AddCaDescriptor(SI::CaDescriptor *d, int EsPid)
const T * First(void) const
Returns the first element in this list, or NULL if the list is empty.
void Add(u_short Pid, u_char Tid, u_char Mask=0xFF, bool Sticky=false)
Adds the given filter data to this filter.
const char * I18nNormalizeLanguageCode(const char *Code)
Returns a 3 letter language code that may not be zero terminated.
@ SubtitlingDescriptorTag
#define STANDARD_ANSISCTE
StructureLoop< Association > associationLoop
int GetPmtPid(int Source, int Transponder, int ServiceId)
Gets the Pid of the PMT in which the CA descriptors for this channel are defined.
cPmtSidEntry(int Sid, cPmtPidEntry *PidEntry)
cCaDescriptorHandler CaDescriptorHandler
cList< cPmtSidEntry > pmtSidList
StructureLoop< Language > languageLoop
bool Check(uchar Version, int SectionNumber)
Returns true if Version is not the current version, or the given SectionNumber has not been marked as...
bool TimedOut(void) const
void PmtPidReset(int PmtPid)
Descriptor * getNext(Iterator &it)
bool SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *CompositionPageIds, uint16_t *AncillaryPageIds)
int NumSidRequests(int Sid)
bool SetCaDescriptors(int Level)
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
Processes the data delivered to this filter.
const T * Next(const T *Object) const
< Returns the element immediately before Object in this list, or NULL if Object is the first element ...
bool operator==(const cCaDescriptors &arg) const
int Source(void)
Returns the source of the data delivered to this filter.
cSectionSyncer sectionSyncer
bool operator==(const cCaDescriptor &arg) const
bool ClearObsoleteChannel(void)
void SetReceived(bool State)
DescriptorLoop commonDescriptors
void Append(const uchar *Data, int Length)
int getVersionNumber() const
cPmtPidEntry * PidEntry(void)
cCaDescriptor(int CaSystem, int CaPid, int EsPid, int Length, const uchar *Data)
const cChannel * GetByServiceID(int Source, int Transponder, unsigned short ServiceID) const
int GetCaPids(const int *CaSystemIds, int BufSize, int *Pids)