vdr  2.4.1
pat.c
Go to the documentation of this file.
1 /*
2  * pat.c: PAT section filter
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: pat.c 4.3.1.2 2019/03/15 13:13:40 kls Exp $
8  */
9 
10 #include "pat.h"
11 #include <malloc.h>
12 #include "channels.h"
13 #include "libsi/section.h"
14 #include "libsi/descriptor.h"
15 
16 #define PMT_SCAN_TIMEOUT 1000 // ms
17 
18 // --- cCaDescriptor ---------------------------------------------------------
19 
20 class cCaDescriptor : public cListObject {
21 private:
22  int caSystem;
23  int caPid;
24  int esPid;
25  int length;
27 public:
28  cCaDescriptor(int CaSystem, int CaPid, int EsPid, int Length, const uchar *Data);
29  virtual ~cCaDescriptor();
30  bool operator== (const cCaDescriptor &arg) const;
31  int CaSystem(void) { return caSystem; }
32  int CaPid(void) { return caPid; }
33  int EsPid(void) { return esPid; }
34  int Length(void) const { return length; }
35  const uchar *Data(void) const { return data; }
36  };
37 
38 cCaDescriptor::cCaDescriptor(int CaSystem, int CaPid, int EsPid, int Length, const uchar *Data)
39 {
41  caPid = CaPid;
42  esPid = EsPid;
43  length = Length + 6;
44  data = MALLOC(uchar, length);
46  data[1] = length - 2;
47  data[2] = (caSystem >> 8) & 0xFF;
48  data[3] = caSystem & 0xFF;
49  data[4] = ((CaPid >> 8) & 0x1F) | 0xE0;
50  data[5] = CaPid & 0xFF;
51  if (Length)
52  memcpy(&data[6], Data, Length);
53 }
54 
56 {
57  free(data);
58 }
59 
61 {
62  return esPid == arg.esPid && length == arg.length && memcmp(data, arg.data, length) == 0;
63 }
64 
65 // --- cCaDescriptors --------------------------------------------------------
66 
67 class cCaDescriptors : public cListObject {
68 private:
69  int source;
71  int serviceId;
72  int pmtPid; // needed for OctopusNet - otherwise irrelevant!
73  int numCaIds;
74  int caIds[MAXCAIDS + 1];
76  void AddCaId(int CaId);
77 public:
78  cCaDescriptors(int Source, int Transponder, int ServiceId, int PmtPid);
79  bool operator== (const cCaDescriptors &arg) const;
80  bool Is(int Source, int Transponder, int ServiceId);
81  bool Is(cCaDescriptors * CaDescriptors);
82  bool Empty(void) { return caDescriptors.Count() == 0; }
83  void AddCaDescriptor(SI::CaDescriptor *d, int EsPid);
84  void GetCaDescriptors(const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid);
85  int GetCaPids(const int *CaSystemIds, int BufSize, int *Pids);
86  const int GetPmtPid(void) { return pmtPid; };
87  const int *CaIds(void) { return caIds; }
88  };
89 
90 cCaDescriptors::cCaDescriptors(int Source, int Transponder, int ServiceId, int PmtPid)
91 {
92  source = Source;
93  transponder = Transponder;
94  serviceId = ServiceId;
95  pmtPid = PmtPid;
96  numCaIds = 0;
97  caIds[0] = 0;
98 }
99 
101 {
102  const cCaDescriptor *ca1 = caDescriptors.First();
103  const cCaDescriptor *ca2 = arg.caDescriptors.First();
104  while (ca1 && ca2) {
105  if (!(*ca1 == *ca2))
106  return false;
107  ca1 = caDescriptors.Next(ca1);
108  ca2 = arg.caDescriptors.Next(ca2);
109  }
110  return !ca1 && !ca2;
111 }
112 
113 bool cCaDescriptors::Is(int Source, int Transponder, int ServiceId)
114 {
115  return source == Source && transponder == Transponder && serviceId == ServiceId;
116 }
117 
118 bool cCaDescriptors::Is(cCaDescriptors *CaDescriptors)
119 {
120  return Is(CaDescriptors->source, CaDescriptors->transponder, CaDescriptors->serviceId);
121 }
122 
124 {
125  if (numCaIds < MAXCAIDS) {
126  for (int i = 0; i < numCaIds; i++) {
127  if (caIds[i] == CaId)
128  return;
129  }
130  caIds[numCaIds++] = CaId;
131  caIds[numCaIds] = 0;
132  }
133 }
134 
136 {
137  cCaDescriptor *nca = new cCaDescriptor(d->getCaType(), d->getCaPid(), EsPid, d->privateData.getLength(), d->privateData.getData());
138  for (cCaDescriptor *ca = caDescriptors.First(); ca; ca = caDescriptors.Next(ca)) {
139  if (*ca == *nca) {
140  delete nca;
141  return;
142  }
143  }
144  AddCaId(nca->CaSystem());
145  caDescriptors.Add(nca);
146 //#define DEBUG_CA_DESCRIPTORS 1
147 #ifdef DEBUG_CA_DESCRIPTORS
148  char buffer[1024];
149  char *q = buffer;
150  q += sprintf(q, "CAM: %04X %5d %5d %04X %04X -", source, transponder, serviceId, d->getCaType(), EsPid);
151  for (int i = 0; i < nca->Length(); i++)
152  q += sprintf(q, " %02X", nca->Data()[i]);
153  dsyslog("%s", buffer);
154 #endif
155 }
156 
157 // EsPid is to select the "type" of CaDescriptor to be returned
158 // >0 - CaDescriptor for the particular esPid
159 // =0 - common CaDescriptor
160 // <0 - all CaDescriptors regardless of type (old default)
161 
162 void cCaDescriptors::GetCaDescriptors(const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid)
163 {
164  Buffer.Clear();
165  if (!CaSystemIds || !*CaSystemIds)
166  return;
167  for (cCaDescriptor *d = caDescriptors.First(); d; d = caDescriptors.Next(d)) {
168  if (EsPid < 0 || d->EsPid() == EsPid) {
169  const int *caids = CaSystemIds;
170  do {
171  if (*caids == 0xFFFF || d->CaSystem() == *caids)
172  Buffer.Append(d->Data(), d->Length());
173  } while (*++caids);
174  }
175  }
176 }
177 
178 int cCaDescriptors::GetCaPids(const int *CaSystemIds, int BufSize, int *Pids)
179 {
180  if (!CaSystemIds || !*CaSystemIds)
181  return 0;
182  if (BufSize > 0 && Pids) {
183  int numPids = 0;
184  for (cCaDescriptor *d = caDescriptors.First(); d; d = caDescriptors.Next(d)) {
185  const int *caids = CaSystemIds;
186  do {
187  if (*caids == 0xFFFF || d->CaSystem() == *caids) {
188  if (numPids + 1 < BufSize) {
189  Pids[numPids++] = d->CaPid();
190  Pids[numPids] = 0;
191  }
192  else
193  return -1;
194  }
195  } while (*++caids);
196  }
197  return numPids;
198  }
199  return -1;
200 }
201 
202 // --- cCaDescriptorHandler --------------------------------------------------
203 
204 class cCaDescriptorHandler : public cList<cCaDescriptors> {
205 private:
207 public:
208  int AddCaDescriptors(cCaDescriptors *CaDescriptors);
209  // Returns 0 if this is an already known descriptor,
210  // 1 if it is an all new descriptor with actual contents,
211  // and 2 if an existing descriptor was changed.
212  void GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid);
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);
215  };
216 
218 {
219  cMutexLock MutexLock(&mutex);
220  for (cCaDescriptors *ca = First(); ca; ca = Next(ca)) {
221  if (ca->Is(CaDescriptors)) {
222  if (*ca == *CaDescriptors) {
223  delete CaDescriptors;
224  return 0;
225  }
226  Del(ca);
227  Add(CaDescriptors);
228  return 2;
229  }
230  }
231  Add(CaDescriptors);
232  return CaDescriptors->Empty() ? 0 : 1;
233 }
234 
235 void cCaDescriptorHandler::GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid)
236 {
237  cMutexLock MutexLock(&mutex);
238  for (cCaDescriptors *ca = First(); ca; ca = Next(ca)) {
239  if (ca->Is(Source, Transponder, ServiceId)) {
240  ca->GetCaDescriptors(CaSystemIds, Buffer, EsPid);
241  break;
242  }
243  }
244 }
245 
246 int cCaDescriptorHandler::GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids)
247 {
248  cMutexLock MutexLock(&mutex);
249  for (cCaDescriptors *ca = First(); ca; ca = Next(ca)) {
250  if (ca->Is(Source, Transponder, ServiceId))
251  return ca->GetCaPids(CaSystemIds, BufSize, Pids);
252  }
253  return 0;
254 }
255 
256 int cCaDescriptorHandler::GetPmtPid(int Source, int Transponder, int ServiceId)
257 {
258  cMutexLock MutexLock(&mutex);
259  for (cCaDescriptors *ca = First(); ca; ca = Next(ca)) {
260  if (ca->Is(Source, Transponder, ServiceId))
261  return ca->GetPmtPid();
262  }
263  return 0;
264 }
265 
267 
268 void GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid)
269 {
270  CaDescriptorHandler.GetCaDescriptors(Source, Transponder, ServiceId, CaSystemIds, Buffer, EsPid);
271 }
272 
273 int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids)
274 {
275  return CaDescriptorHandler.GetCaPids(Source, Transponder, ServiceId, CaSystemIds, BufSize, Pids);
276 }
277 
278 int GetPmtPid(int Source, int Transponder, int ServiceId)
279 {
280  return CaDescriptorHandler.GetPmtPid(Source, Transponder, ServiceId);
281 }
282 
283 // --- cPatFilter ------------------------------------------------------------
284 
285 //#define DEBUG_PAT_PMT
286 #ifdef DEBUG_PAT_PMT
287 #define DBGLOG(a...) { cString s = cString::sprintf(a); fprintf(stderr, "%s\n", *s); dsyslog("%s", *s); }
288 #else
289 #define DBGLOG(a...)
290 #endif
291 
293 {
294  Trigger(0);
295  Set(0x00, 0x00); // PAT
296 }
297 
299 {
300  cMutexLock MutexLock(&mutex);
301  DBGLOG("PAT filter set status %d", On);
302  cFilter::SetStatus(On);
303  Trigger();
304 }
305 
306 void cPatFilter::Trigger(int Sid)
307 {
308  cMutexLock MutexLock(&mutex);
309  patVersion = -1;
310  pmtIndex = -1;
311  numPmtEntries = 0;
312  if (Sid >= 0) {
313  sid = Sid;
314  DBGLOG("PAT filter trigger SID %d", Sid);
315  }
316 }
317 
318 bool cPatFilter::PmtVersionChanged(int PmtPid, int Sid, int Version, bool SetNewVersion)
319 {
320  int Id = MakePmtId(PmtPid, Sid);
321  for (int i = 0; i < numPmtEntries; i++) {
322  if (pmtId[i] == Id) {
323  if (pmtVersion[i] != Version) {
324  if (SetNewVersion)
325  pmtVersion[i] = Version;
326  else
327  DBGLOG("PMT %d %2d %5d %2d -> %2d", Transponder(), i, PmtPid, pmtVersion[i], Version);
328  return true;
329  }
330  break;
331  }
332  }
333  return false;
334 }
335 
337 {
338  if (pmtIndex >= 0) {
340  pmtIndex = (pmtIndex + 1) % numPmtEntries;
342  }
343 }
344 
345 void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
346 {
347  cMutexLock MutexLock(&mutex);
348  if (Pid == 0x00) {
349  if (Tid == SI::TableIdPAT) {
350  SI::PAT pat(Data, false);
351  if (!pat.CheckCRCAndParse())
352  return;
353  if (pat.getVersionNumber() != patVersion) {
354  DBGLOG("PAT %d %d -> %d", Transponder(), patVersion, pat.getVersionNumber());
355  if (pmtIndex >= 0) {
357  pmtIndex = -1;
358  }
359  numPmtEntries = 0;
360  SI::PAT::Association assoc;
361  for (SI::Loop::Iterator it; pat.associationLoop.getNext(assoc, it); ) {
362  if (!assoc.isNITPid() && numPmtEntries < MAXPMTENTRIES) {
363  DBGLOG(" PMT pid %2d %5d SID %5d", numPmtEntries, assoc.getPid(), assoc.getServiceId());
364  pmtId[numPmtEntries] = MakePmtId(assoc.getPid(), assoc.getServiceId());
366  if (sid == assoc.getServiceId()) {
368  DBGLOG("sid = %d pmtIndex = %d", sid, pmtIndex);
369  }
370  numPmtEntries++;
371  }
372  }
373  if (numPmtEntries > 0 && pmtIndex < 0)
374  pmtIndex = 0;
375  if (pmtIndex >= 0)
379  }
380  }
381  }
382  else if (Tid == SI::TableIdPMT && Source() && Transponder()) {
384  SI::PMT pmt(Data, false);
385  if (!pmt.CheckCRCAndParse())
386  return;
387  if (!PmtVersionChanged(Pid, pmt.getTableIdExtension(), pmt.getVersionNumber())) {
389  return;
390  }
391  cStateKey StateKey;
392  cChannels *Channels = cChannels::GetChannelsWrite(StateKey, 10);
393  if (!Channels)
394  return;
395  bool ChannelsModified = false;
396  PmtVersionChanged(Pid, pmt.getTableIdExtension(), pmt.getVersionNumber(), true);
398  cChannel *Channel = Channels->GetByServiceID(Source(), Transponder(), pmt.getServiceId());
399  if (Channel) {
400  SI::CaDescriptor *d;
401  cCaDescriptors *CaDescriptors = new cCaDescriptors(Channel->Source(), Channel->Transponder(), Channel->Sid(), Pid);
402  // Scan the common loop:
404  CaDescriptors->AddCaDescriptor(d, 0);
405  delete d;
406  }
407  // Scan the stream-specific loop:
408  SI::PMT::Stream stream;
409  int Vpid = 0;
410  int Ppid = 0;
411  int Vtype = 0;
412  int Apids[MAXAPIDS + 1] = { 0 }; // these lists are zero-terminated
413  int Atypes[MAXAPIDS + 1] = { 0 };
414  int Dpids[MAXDPIDS + 1] = { 0 };
415  int Dtypes[MAXDPIDS + 1] = { 0 };
416  int Spids[MAXSPIDS + 1] = { 0 };
417  uchar SubtitlingTypes[MAXSPIDS + 1] = { 0 };
418  uint16_t CompositionPageIds[MAXSPIDS + 1] = { 0 };
419  uint16_t AncillaryPageIds[MAXSPIDS + 1] = { 0 };
420  char ALangs[MAXAPIDS][MAXLANGCODE2] = { "" };
421  char DLangs[MAXDPIDS][MAXLANGCODE2] = { "" };
422  char SLangs[MAXSPIDS][MAXLANGCODE2] = { "" };
423  int Tpid = 0;
424  int NumApids = 0;
425  int NumDpids = 0;
426  int NumSpids = 0;
427  for (SI::Loop::Iterator it; pmt.streamLoop.getNext(stream, it); ) {
428  bool ProcessCaDescriptors = false;
429  int esPid = stream.getPid();
430  switch (stream.getStreamType()) {
431  case 1: // STREAMTYPE_11172_VIDEO
432  case 2: // STREAMTYPE_13818_VIDEO
433  case 0x1B: // H.264
434  case 0x24: // H.265
435  Vpid = esPid;
436  Ppid = pmt.getPCRPid();
437  Vtype = stream.getStreamType();
438  ProcessCaDescriptors = true;
439  break;
440  case 3: // STREAMTYPE_11172_AUDIO
441  case 4: // STREAMTYPE_13818_AUDIO
442  case 0x0F: // ISO/IEC 13818-7 Audio with ADTS transport syntax
443  case 0x11: // ISO/IEC 14496-3 Audio with LATM transport syntax
444  {
445  if (NumApids < MAXAPIDS) {
446  Apids[NumApids] = esPid;
447  Atypes[NumApids] = stream.getStreamType();
448  SI::Descriptor *d;
449  for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) {
450  switch (d->getDescriptorTag()) {
454  char *s = ALangs[NumApids];
455  int n = 0;
456  for (SI::Loop::Iterator it; ld->languageLoop.getNext(l, it); ) {
457  if (*ld->languageCode != '-') { // some use "---" to indicate "none"
458  if (n > 0)
459  *s++ = '+';
461  s += strlen(s);
462  if (n++ > 1)
463  break;
464  }
465  }
466  }
467  break;
468  default: ;
469  }
470  delete d;
471  }
472  NumApids++;
473  }
474  ProcessCaDescriptors = true;
475  }
476  break;
477  case 5: // STREAMTYPE_13818_PRIVATE
478  case 6: // STREAMTYPE_13818_PES_PRIVATE
479  //XXX case 8: // STREAMTYPE_13818_DSMCC
480  {
481  int dpid = 0;
482  int dtype = 0;
483  char lang[MAXLANGCODE1] = { 0 };
484  SI::Descriptor *d;
485  for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) {
486  switch (d->getDescriptorTag()) {
489  dpid = esPid;
490  dtype = d->getDescriptorTag();
491  ProcessCaDescriptors = true;
492  break;
494  if (NumSpids < MAXSPIDS) {
495  Spids[NumSpids] = esPid;
498  char *s = SLangs[NumSpids];
499  int n = 0;
500  for (SI::Loop::Iterator it; sd->subtitlingLoop.getNext(sub, it); ) {
501  if (sub.languageCode[0]) {
502  SubtitlingTypes[NumSpids] = sub.getSubtitlingType();
503  CompositionPageIds[NumSpids] = sub.getCompositionPageId();
504  AncillaryPageIds[NumSpids] = sub.getAncillaryPageId();
505  if (n > 0)
506  *s++ = '+';
508  s += strlen(s);
509  if (n++ > 1)
510  break;
511  }
512  }
513  NumSpids++;
514  }
515  break;
517  Tpid = esPid;
518  break;
522  }
523  break;
524  default: ;
525  }
526  delete d;
527  }
528  if (dpid) {
529  if (NumDpids < MAXDPIDS) {
530  Dpids[NumDpids] = dpid;
531  Dtypes[NumDpids] = dtype;
532  strn0cpy(DLangs[NumDpids], lang, MAXLANGCODE1);
533  NumDpids++;
534  }
535  }
536  }
537  break;
538  case 0x80: // STREAMTYPE_USER_PRIVATE
539  if (Setup.StandardCompliance == STANDARD_ANSISCTE) { // DigiCipher II VIDEO (ANSI/SCTE 57)
540  Vpid = esPid;
541  Ppid = pmt.getPCRPid();
542  Vtype = 0x02; // compression based upon MPEG-2
543  ProcessCaDescriptors = true;
544  break;
545  }
546  // fall through
547  case 0x81: // STREAMTYPE_USER_PRIVATE
548  case 0x87: // eac3
549  if (Setup.StandardCompliance == STANDARD_ANSISCTE) { // ATSC A/53 AUDIO (ANSI/SCTE 57)
550  char lang[MAXLANGCODE1] = { 0 };
551  SI::Descriptor *d;
552  for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) {
553  switch (d->getDescriptorTag()) {
557  }
558  break;
559  default: ;
560  }
561  delete d;
562  }
563  if (NumDpids < MAXDPIDS) {
564  Dpids[NumDpids] = esPid;
565  Dtypes[NumDpids] = SI::AC3DescriptorTag;
566  strn0cpy(DLangs[NumDpids], lang, MAXLANGCODE1);
567  NumDpids++;
568  }
569  ProcessCaDescriptors = true;
570  break;
571  }
572  // fall through
573  case 0x82: // STREAMTYPE_USER_PRIVATE
574  if (Setup.StandardCompliance == STANDARD_ANSISCTE) { // STANDARD SUBTITLE (ANSI/SCTE 27)
575  //TODO
576  break;
577  }
578  // fall through
579  case 0x83 ... 0x86: // STREAMTYPE_USER_PRIVATE
580  case 0x88 ... 0xFF: // STREAMTYPE_USER_PRIVATE
581  {
582  char lang[MAXLANGCODE1] = { 0 };
583  bool IsAc3 = false;
584  SI::Descriptor *d;
585  for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) {
586  switch (d->getDescriptorTag()) {
589  // http://www.smpte-ra.org/mpegreg/mpegreg.html
590  switch (rd->getFormatIdentifier()) {
591  case 0x41432D33: // 'AC-3'
592  IsAc3 = true;
593  break;
594  default:
595  //printf("Format identifier: 0x%08X (pid: %d)\n", rd->getFormatIdentifier(), esPid);
596  break;
597  }
598  }
599  break;
603  }
604  break;
605  default: ;
606  }
607  delete d;
608  }
609  if (IsAc3) {
610  if (NumDpids < MAXDPIDS) {
611  Dpids[NumDpids] = esPid;
612  Dtypes[NumDpids] = SI::AC3DescriptorTag;
613  strn0cpy(DLangs[NumDpids], lang, MAXLANGCODE1);
614  NumDpids++;
615  }
616  ProcessCaDescriptors = true;
617  }
618  }
619  break;
620  default: ;//printf("PID: %5d %5d %2d %3d %3d\n", pmt.getServiceId(), stream.getPid(), stream.getStreamType(), pmt.getVersionNumber(), Channel->Number());
621  }
622  if (ProcessCaDescriptors) {
624  CaDescriptors->AddCaDescriptor(d, esPid);
625  delete d;
626  }
627  }
628  }
629  if (Setup.UpdateChannels >= 2) {
630  ChannelsModified |= Channel->SetPids(Vpid, Ppid, Vtype, Apids, Atypes, ALangs, Dpids, Dtypes, DLangs, Spids, SLangs, Tpid);
631  ChannelsModified |= Channel->SetCaIds(CaDescriptors->CaIds());
632  ChannelsModified |= Channel->SetSubtitlingDescriptors(SubtitlingTypes, CompositionPageIds, AncillaryPageIds);
633  }
634  ChannelsModified |= Channel->SetCaDescriptors(CaDescriptorHandler.AddCaDescriptors(CaDescriptors));
635  }
636  StateKey.Remove(ChannelsModified);
637  }
638  if (timer.TimedOut()) {
639  if (pmtIndex >= 0)
640  DBGLOG("PMT timeout %d", pmtIndex);
643  }
644 }
cCaDescriptor::caSystem
int caSystem
Definition: pat.c:22
GetCaPids
int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids)
Gets all CA pids for a given channel.
Definition: pat.c:273
cFilter::SetStatus
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
Definition: filter.c:129
cCaDescriptors::transponder
int transponder
Definition: pat.c:70
cCaDescriptors::GetPmtPid
const int GetPmtPid(void)
Definition: pat.c:86
cPatFilter::pmtIndex
int pmtIndex
Definition: pat.h:24
SI::RegistrationDescriptorTag
@ RegistrationDescriptorTag
Definition: si.h:66
cFilter::Transponder
int Transponder(void)
Returns the transponder of the data delivered to this filter.
Definition: filter.c:119
SI::CaDescriptor::getCaPid
int getCaPid() const
Definition: descriptor.c:360
cCaDescriptorHandler::GetCaPids
int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids)
Definition: pat.c:246
cChannel::SetCaIds
bool SetCaIds(const int *CaIds)
Definition: channels.c:454
cFilter::Set
void Set(u_short Pid, u_char Tid, u_char Mask=0xFF)
Sets the given filter data by calling Add() with Sticky = true.
Definition: filter.c:162
SI::Loop::Iterator
Definition: si.h:333
SI::SubtitlingDescriptor::Subtitling::getCompositionPageId
int getCompositionPageId() const
Definition: descriptor.c:610
SI::PAT::Association::getServiceId
int getServiceId() const
Definition: section.c:40
cCaDescriptors::cCaDescriptors
cCaDescriptors(int Source, int Transponder, int ServiceId, int PmtPid)
Definition: pat.c:90
cCaDescriptors::pmtPid
int pmtPid
Definition: pat.c:72
cCaDescriptor::Length
int Length(void) const
Definition: pat.c:34
cPatFilter::GetPmtPid
int GetPmtPid(int Index)
Definition: pat.h:29
cChannel::SetPids
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)
Definition: channels.c:341
SI::PMT
Definition: section.h:65
cCaDescriptor::Data
const uchar * Data(void) const
Definition: pat.c:35
MAXDPIDS
#define MAXDPIDS
Definition: channels.h:32
SI::PMT::Stream::getStreamType
int getStreamType() const
Definition: section.c:79
cChannel::Source
int Source(void) const
Definition: channels.h:152
SI::SubtitlingDescriptor::Subtitling::languageCode
char languageCode[4]
Definition: descriptor.h:331
cCaDescriptor::CaPid
int CaPid(void)
Definition: pat.c:32
cChannel::Sid
int Sid(void) const
Definition: channels.h:176
cPatFilter::timer
cTimeMs timer
Definition: pat.h:22
MAXSPIDS
#define MAXSPIDS
Definition: channels.h:33
section.h
SI::SubtitlingDescriptor::Subtitling::getAncillaryPageId
int getAncillaryPageId() const
Definition: descriptor.c:614
MAXLANGCODE1
#define MAXLANGCODE1
Definition: channels.h:36
SI::CRCSection::CheckCRCAndParse
bool CheckCRCAndParse()
Definition: si.c:75
SI::RegistrationDescriptor::getFormatIdentifier
int getFormatIdentifier() const
Definition: descriptor.c:1194
cPatFilter::patVersion
int patVersion
Definition: pat.h:23
cListBase::Count
int Count(void) const
Definition: tools.h:590
cListBase::Add
void Add(cListObject *Object, cListObject *After=NULL)
Definition: tools.c:2152
cCaDescriptor::caPid
int caPid
Definition: pat.c:23
cFilter::Del
void Del(u_short Pid, u_char Tid, u_char Mask=0xFF)
Deletes the given filter data from this filter.
Definition: filter.c:175
cSetup::UpdateChannels
int UpdateChannels
Definition: config.h:318
cCaDescriptorHandler::AddCaDescriptors
int AddCaDescriptors(cCaDescriptors *CaDescriptors)
Definition: pat.c:217
SI::SubtitlingDescriptor
Definition: descriptor.h:327
cCaDescriptor::EsPid
int EsPid(void)
Definition: pat.c:33
SI::u_char
unsigned char u_char
Definition: headers.h:38
cChannels::GetChannelsWrite
static cChannels * GetChannelsWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of channels for write access.
Definition: channels.c:855
cMutexLock
Definition: thread.h:141
SI::PMT::streamLoop
StructureLoop< Stream > streamLoop
Definition: section.h:81
cCaDescriptor::length
int length
Definition: pat.c:25
Setup
cSetup Setup
Definition: config.c:372
cStateKey
Definition: thread.h:233
cTimeMs::Set
void Set(int Ms=0)
Definition: tools.c:774
cPatFilter::Trigger
void Trigger(int Sid=-1)
Definition: pat.c:306
cChannel::Transponder
int Transponder(void) const
Returns the transponder frequency in MHz, plus the polarization in case of sat.
Definition: channels.c:147
SI::CaDescriptor::privateData
CharArray privateData
Definition: descriptor.h:157
SI::RegistrationDescriptor
Definition: descriptor.h:774
cPatFilter::PmtVersionChanged
bool PmtVersionChanged(int PmtPid, int Sid, int Version, bool SetNewVersion=false)
Definition: pat.c:318
SI::PMT::getPCRPid
int getPCRPid() const
Definition: section.c:71
SI::SubtitlingDescriptor::Subtitling
Definition: descriptor.h:329
SI::TeletextDescriptorTag
@ TeletextDescriptorTag
Definition: si.h:110
cMutex
Definition: thread.h:67
SI::PAT::Association::getPid
int getPid() const
Definition: section.c:44
cCaDescriptor::esPid
int esPid
Definition: pat.c:24
SI::EnhancedAC3DescriptorTag
@ EnhancedAC3DescriptorTag
Definition: si.h:147
channels.h
SI::NumberedSection::getTableIdExtension
int getTableIdExtension() const
Definition: si.c:82
cListBase::Del
void Del(cListObject *Object, bool DeleteObject=true)
Definition: tools.c:2184
SI::TableIdPMT
@ TableIdPMT
Definition: si.h:45
cCaDescriptors::caDescriptors
cList< cCaDescriptor > caDescriptors
Definition: pat.c:75
cListObject
Definition: tools.h:493
MAXLANGCODE2
#define MAXLANGCODE2
Definition: channels.h:37
PMT_SCAN_TIMEOUT
#define PMT_SCAN_TIMEOUT
Definition: pat.c:16
SI::SubtitlingDescriptor::Subtitling::getSubtitlingType
int getSubtitlingType() const
Definition: descriptor.c:606
cPatFilter::pmtId
int pmtId[MAXPMTENTRIES]
Definition: pat.h:25
SI::AC3DescriptorTag
@ AC3DescriptorTag
Definition: si.h:130
SI::SubtitlingDescriptor::subtitlingLoop
StructureLoop< Subtitling > subtitlingLoop
Definition: descriptor.h:341
SI::CharArray::getData
const unsigned char * getData() const
Definition: util.h:51
cPatFilter::numPmtEntries
int numPmtEntries
Definition: pat.h:27
cCaDescriptors::GetCaDescriptors
void GetCaDescriptors(const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid)
Definition: pat.c:162
SI::TableIdPAT
@ TableIdPAT
Definition: si.h:43
cCaDescriptorHandler::mutex
cMutex mutex
Definition: pat.c:206
uchar
unsigned char uchar
Definition: tools.h:31
SI::CaDescriptor::getCaType
int getCaType() const
Definition: descriptor.c:356
SI::Descriptor::getDescriptorTag
DescriptorTag getDescriptorTag() const
Definition: si.c:110
cCaDescriptors::Is
bool Is(int Source, int Transponder, int ServiceId)
Definition: pat.c:113
SI::ISO639LanguageDescriptorTag
@ ISO639LanguageDescriptorTag
Definition: si.h:71
GetCaDescriptors
void GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid)
Gets all CA descriptors for a given channel.
Definition: pat.c:268
SI::PMT::Stream::streamDescriptors
DescriptorLoop streamDescriptors
Definition: section.h:73
cStateKey::Remove
void Remove(bool IncState=true)
Removes this key from the lock it was previously used with.
Definition: thread.c:859
cChannels
Definition: channels.h:210
SI::CaDescriptor
Definition: descriptor.h:153
cFilter::Channel
const cChannel * Channel(void)
Returns the channel of the data delivered to this filter.
Definition: filter.c:124
cCaDescriptorHandler::GetCaDescriptors
void GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid)
Definition: pat.c:235
cPatFilter::SwitchToNextPmtPid
void SwitchToNextPmtPid(void)
Definition: pat.c:336
cList< cCaDescriptor >
cCaDescriptors::source
int source
Definition: pat.c:69
cCaDescriptorHandler::GetPmtPid
int GetPmtPid(int Source, int Transponder, int ServiceId)
Definition: pat.c:256
cCaDescriptors::AddCaDescriptor
void AddCaDescriptor(SI::CaDescriptor *d, int EsPid)
Definition: pat.c:135
cList::First
const T * First(void) const
Returns the first element in this list, or NULL if the list is empty.
Definition: tools.h:606
cCaDescriptors::numCaIds
int numCaIds
Definition: pat.c:73
cPatFilter::pmtVersion
int pmtVersion[MAXPMTENTRIES]
Definition: pat.h:26
cFilter::Add
void Add(u_short Pid, u_char Tid, u_char Mask=0xFF, bool Sticky=false)
Adds the given filter data to this filter.
Definition: filter.c:167
cPatFilter::MakePmtId
int MakePmtId(int PmtPid, int Sid)
Definition: pat.h:30
dsyslog
#define dsyslog(a...)
Definition: tools.h:37
SI::Descriptor
Definition: si.h:312
cCaDescriptor
Definition: pat.c:20
cChannel
Definition: channels.h:89
I18nNormalizeLanguageCode
const char * I18nNormalizeLanguageCode(const char *Code)
Returns a 3 letter language code that may not be zero terminated.
Definition: i18n.c:238
pat.h
cCaDescriptor::CaSystem
int CaSystem(void)
Definition: pat.c:31
cCaDescriptors::CaIds
const int * CaIds(void)
Definition: pat.c:87
MALLOC
#define MALLOC(type, size)
Definition: tools.h:47
SI::SubtitlingDescriptorTag
@ SubtitlingDescriptorTag
Definition: si.h:113
STANDARD_ANSISCTE
#define STANDARD_ANSISCTE
Definition: config.h:71
SI::PAT::associationLoop
StructureLoop< Association > associationLoop
Definition: section.h:59
cCaDescriptors::serviceId
int serviceId
Definition: pat.c:71
cCaDescriptor::data
uchar * data
Definition: pat.c:26
MAXPMTENTRIES
#define MAXPMTENTRIES
Definition: pat.h:17
GetPmtPid
int GetPmtPid(int Source, int Transponder, int ServiceId)
Gets the Pid of the PMT in which the CA descriptors for this channel are defined.
Definition: pat.c:278
SI::PMT::getServiceId
int getServiceId() const
Definition: section.c:67
cPatFilter::cPatFilter
cPatFilter(void)
Definition: pat.c:292
cCaDescriptorHandler
Definition: pat.c:204
CaDescriptorHandler
cCaDescriptorHandler CaDescriptorHandler
Definition: pat.c:266
SI::ISO639LanguageDescriptor::languageLoop
StructureLoop< Language > languageLoop
Definition: descriptor.h:499
cPatFilter::mutex
cMutex mutex
Definition: pat.h:21
strn0cpy
char * strn0cpy(char *dest, const char *src, size_t n)
Definition: tools.c:131
MAXCAIDS
#define MAXCAIDS
Definition: channels.h:34
cTimeMs::TimedOut
bool TimedOut(void) const
Definition: tools.c:779
SI::PMT::Stream
Definition: section.h:69
SI::PAT::Association
Definition: section.h:47
SI::DescriptorLoop::getNext
Descriptor * getNext(Iterator &it)
Definition: si.c:122
cChannel::SetSubtitlingDescriptors
bool SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *CompositionPageIds, uint16_t *AncillaryPageIds)
Definition: channels.c:409
cChannel::SetCaDescriptors
bool SetCaDescriptors(int Level)
Definition: channels.c:476
cPatFilter::SetStatus
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
Definition: pat.c:298
SI::ISO639LanguageDescriptor::Language
Definition: descriptor.h:489
MAXAPIDS
#define MAXAPIDS
Definition: channels.h:31
SI::CaDescriptorTag
@ CaDescriptorTag
Definition: si.h:70
cDynamicBuffer
Definition: tools.h:826
cPatFilter::Process
virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
Processes the data delivered to this filter.
Definition: pat.c:345
cList::Next
const T * Next(const T *Object) const
< Returns the element immediately before Object in this list, or NULL if Object is the first element ...
Definition: tools.h:613
cPatFilter::sid
int sid
Definition: pat.h:28
cCaDescriptors::operator==
bool operator==(const cCaDescriptors &arg) const
Definition: pat.c:100
cDynamicBuffer::Clear
void Clear(void)
Definition: tools.h:841
cSetup::StandardCompliance
int StandardCompliance
Definition: config.h:283
cCaDescriptors::Empty
bool Empty(void)
Definition: pat.c:82
cFilter::Source
int Source(void)
Returns the source of the data delivered to this filter.
Definition: filter.c:114
SI::CharArray::getLength
int getLength() const
Definition: util.h:58
cCaDescriptor::operator==
bool operator==(const cCaDescriptor &arg) const
Definition: pat.c:60
cCaDescriptors::AddCaId
void AddCaId(int CaId)
Definition: pat.c:123
SI::PMT::commonDescriptors
DescriptorLoop commonDescriptors
Definition: section.h:80
SI::PAT
Definition: section.h:33
cDynamicBuffer::Append
void Append(const uchar *Data, int Length)
Definition: tools.c:2328
cCaDescriptors::caIds
int caIds[MAXCAIDS+1]
Definition: pat.c:74
SI::NumberedSection::getVersionNumber
int getVersionNumber() const
Definition: si.c:94
SI::PMT::Stream::getPid
int getPid() const
Definition: section.c:75
DBGLOG
#define DBGLOG(a...)
Definition: pat.c:289
cCaDescriptor::cCaDescriptor
cCaDescriptor(int CaSystem, int CaPid, int EsPid, int Length, const uchar *Data)
Definition: pat.c:38
descriptor.h
cCaDescriptors
Definition: pat.c:67
cCaDescriptor::~cCaDescriptor
virtual ~cCaDescriptor()
Definition: pat.c:55
SI::PAT::Association::isNITPid
bool isNITPid() const
Definition: section.h:51
SI::ISO639LanguageDescriptor::languageCode
char languageCode[4]
Definition: descriptor.h:488
cChannels::GetByServiceID
const cChannel * GetByServiceID(int Source, int Transponder, unsigned short ServiceID) const
Definition: channels.c:1005
SI::ISO639LanguageDescriptor::Language::languageCode
char languageCode[4]
Definition: descriptor.h:492
SI::ISO639LanguageDescriptor
Definition: descriptor.h:486
cCaDescriptors::GetCaPids
int GetCaPids(const int *CaSystemIds, int BufSize, int *Pids)
Definition: pat.c:178