vdr  2.2.0
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 3.5 2015/01/04 13:14:01 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 
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  int GetCaDescriptors(const int *CaSystemIds, int BufSize, uchar *Data, 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  cCaDescriptor *ca1 = caDescriptors.First();
103  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 {
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 int cCaDescriptors::GetCaDescriptors(const int *CaSystemIds, int BufSize, uchar *Data, int EsPid)
163 {
164  if (!CaSystemIds || !*CaSystemIds)
165  return 0;
166  if (BufSize > 0 && Data) {
167  int length = 0;
168  for (cCaDescriptor *d = caDescriptors.First(); d; d = caDescriptors.Next(d)) {
169  if (EsPid < 0 || d->EsPid() == EsPid) {
170  const int *caids = CaSystemIds;
171  do {
172  if (*caids == 0xFFFF || d->CaSystem() == *caids) {
173  if (length + d->Length() <= BufSize) {
174  memcpy(Data + length, d->Data(), d->Length());
175  length += d->Length();
176  }
177  else
178  return -1;
179  }
180  } while (*++caids);
181  }
182  }
183  return length;
184  }
185  return -1;
186 }
187 
188 int cCaDescriptors::GetCaPids(const int *CaSystemIds, int BufSize, int *Pids)
189 {
190  if (!CaSystemIds || !*CaSystemIds)
191  return 0;
192  if (BufSize > 0 && Pids) {
193  int numPids = 0;
194  for (cCaDescriptor *d = caDescriptors.First(); d; d = caDescriptors.Next(d)) {
195  const int *caids = CaSystemIds;
196  do {
197  if (*caids == 0xFFFF || d->CaSystem() == *caids) {
198  if (numPids + 1 < BufSize) {
199  Pids[numPids++] = d->CaPid();
200  Pids[numPids] = 0;
201  }
202  else
203  return -1;
204  }
205  } while (*++caids);
206  }
207  return numPids;
208  }
209  return -1;
210 }
211 
212 // --- cCaDescriptorHandler --------------------------------------------------
213 
214 class cCaDescriptorHandler : public cList<cCaDescriptors> {
215 private:
217 public:
218  int AddCaDescriptors(cCaDescriptors *CaDescriptors);
219  // Returns 0 if this is an already known descriptor,
220  // 1 if it is an all new descriptor with actual contents,
221  // and 2 if an existing descriptor was changed.
222  int GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, uchar *Data, int EsPid);
223  int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids);
224  int GetPmtPid(int Source, int Transponder, int ServiceId);
225  };
226 
228 {
229  cMutexLock MutexLock(&mutex);
230  for (cCaDescriptors *ca = First(); ca; ca = Next(ca)) {
231  if (ca->Is(CaDescriptors)) {
232  if (*ca == *CaDescriptors) {
233  delete CaDescriptors;
234  return 0;
235  }
236  Del(ca);
237  Add(CaDescriptors);
238  return 2;
239  }
240  }
241  Add(CaDescriptors);
242  return CaDescriptors->Empty() ? 0 : 1;
243 }
244 
245 int cCaDescriptorHandler::GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, uchar *Data, int EsPid)
246 {
247  cMutexLock MutexLock(&mutex);
248  for (cCaDescriptors *ca = First(); ca; ca = Next(ca)) {
249  if (ca->Is(Source, Transponder, ServiceId))
250  return ca->GetCaDescriptors(CaSystemIds, BufSize, Data, EsPid);
251  }
252  return 0;
253 }
254 
255 int cCaDescriptorHandler::GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids)
256 {
257  cMutexLock MutexLock(&mutex);
258  for (cCaDescriptors *ca = First(); ca; ca = Next(ca)) {
259  if (ca->Is(Source, Transponder, ServiceId))
260  return ca->GetCaPids(CaSystemIds, BufSize, Pids);
261  }
262  return 0;
263 }
264 
265 int cCaDescriptorHandler::GetPmtPid(int Source, int Transponder, int ServiceId)
266 {
267  cMutexLock MutexLock(&mutex);
268  for (cCaDescriptors *ca = First(); ca; ca = Next(ca)) {
269  if (ca->Is(Source, Transponder, ServiceId))
270  return ca->GetPmtPid();
271  }
272  return 0;
273 }
274 
276 
277 int GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, uchar *Data, int EsPid)
278 {
279  return CaDescriptorHandler.GetCaDescriptors(Source, Transponder, ServiceId, CaSystemIds, BufSize, Data, EsPid);
280 }
281 
282 int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids)
283 {
284  return CaDescriptorHandler.GetCaPids(Source, Transponder, ServiceId, CaSystemIds, BufSize, Pids);
285 }
286 
287 int GetPmtPid(int Source, int Transponder, int ServiceId)
288 {
289  return CaDescriptorHandler.GetPmtPid(Source, Transponder, ServiceId);
290 }
291 
292 // --- cPatFilter ------------------------------------------------------------
293 
294 //#define DEBUG_PAT_PMT
295 #ifdef DEBUG_PAT_PMT
296 #define DBGLOG(a...) { cString s = cString::sprintf(a); fprintf(stderr, "%s\n", *s); dsyslog("%s", *s); }
297 #else
298 #define DBGLOG(a...)
299 #endif
300 
302 {
303  Trigger(0);
304  Set(0x00, 0x00); // PAT
305 }
306 
308 {
309  cMutexLock MutexLock(&mutex);
310  DBGLOG("PAT filter set status %d", On);
311  cFilter::SetStatus(On);
312  Trigger();
313 }
314 
315 void cPatFilter::Trigger(int Sid)
316 {
317  cMutexLock MutexLock(&mutex);
318  patVersion = -1;
319  pmtIndex = -1;
320  numPmtEntries = 0;
321  if (Sid >= 0) {
322  sid = Sid;
323  DBGLOG("PAT filter trigger SID %d", Sid);
324  }
325 }
326 
327 bool cPatFilter::PmtVersionChanged(int PmtPid, int Sid, int Version, bool SetNewVersion)
328 {
329  int Id = MakePmtId(PmtPid, Sid);
330  for (int i = 0; i < numPmtEntries; i++) {
331  if (pmtId[i] == Id) {
332  if (pmtVersion[i] != Version) {
333  if (SetNewVersion)
334  pmtVersion[i] = Version;
335  else
336  DBGLOG("PMT %d %2d %5d %2d -> %2d", Transponder(), i, PmtPid, pmtVersion[i], Version);
337  return true;
338  }
339  break;
340  }
341  }
342  return false;
343 }
344 
346 {
347  if (pmtIndex >= 0) {
348  Del(GetPmtPid(pmtIndex), SI::TableIdPMT);
349  pmtIndex = (pmtIndex + 1) % numPmtEntries;
350  Add(GetPmtPid(pmtIndex), SI::TableIdPMT);
351  }
352 }
353 
354 void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
355 {
356  cMutexLock MutexLock(&mutex);
357  if (Pid == 0x00) {
358  if (Tid == SI::TableIdPAT) {
359  SI::PAT pat(Data, false);
360  if (!pat.CheckCRCAndParse())
361  return;
362  if (pat.getVersionNumber() != patVersion) {
363  DBGLOG("PAT %d %d -> %d", Transponder(), patVersion, pat.getVersionNumber());
364  if (pmtIndex >= 0) {
365  Del(GetPmtPid(pmtIndex), SI::TableIdPMT);
366  pmtIndex = -1;
367  }
368  numPmtEntries = 0;
369  SI::PAT::Association assoc;
370  for (SI::Loop::Iterator it; pat.associationLoop.getNext(assoc, it); ) {
371  if (!assoc.isNITPid() && numPmtEntries < MAXPMTENTRIES) {
372  DBGLOG(" PMT pid %2d %5d SID %5d", numPmtEntries, assoc.getPid(), assoc.getServiceId());
373  pmtId[numPmtEntries] = MakePmtId(assoc.getPid(), assoc.getServiceId());
374  pmtVersion[numPmtEntries] = -1;
375  if (sid == assoc.getServiceId()) {
376  pmtIndex = numPmtEntries;
377  DBGLOG("sid = %d pmtIndex = %d", sid, pmtIndex);
378  }
379  numPmtEntries++;
380  }
381  }
382  if (numPmtEntries > 0 && pmtIndex < 0)
383  pmtIndex = 0;
384  Add(GetPmtPid(pmtIndex), SI::TableIdPMT);
385  patVersion = pat.getVersionNumber();
386  timer.Set(PMT_SCAN_TIMEOUT);
387  }
388  }
389  }
390  else if (Tid == SI::TableIdPMT && Source() && Transponder()) {
391  timer.Set(PMT_SCAN_TIMEOUT);
392  SI::PMT pmt(Data, false);
393  if (!pmt.CheckCRCAndParse())
394  return;
395  if (!PmtVersionChanged(Pid, pmt.getTableIdExtension(), pmt.getVersionNumber())) {
396  SwitchToNextPmtPid();
397  return;
398  }
399  if (!Channels.Lock(true, 10))
400  return;
401  PmtVersionChanged(Pid, pmt.getTableIdExtension(), pmt.getVersionNumber(), true);
402  SwitchToNextPmtPid();
403  cChannel *Channel = Channels.GetByServiceID(Source(), Transponder(), pmt.getServiceId());
404  if (Channel) {
405  SI::CaDescriptor *d;
406  cCaDescriptors *CaDescriptors = new cCaDescriptors(Channel->Source(), Channel->Transponder(), Channel->Sid(), Pid);
407  // Scan the common loop:
409  CaDescriptors->AddCaDescriptor(d, 0);
410  delete d;
411  }
412  // Scan the stream-specific loop:
413  SI::PMT::Stream stream;
414  int Vpid = 0;
415  int Ppid = 0;
416  int Vtype = 0;
417  int Apids[MAXAPIDS + 1] = { 0 }; // these lists are zero-terminated
418  int Atypes[MAXAPIDS + 1] = { 0 };
419  int Dpids[MAXDPIDS + 1] = { 0 };
420  int Dtypes[MAXDPIDS + 1] = { 0 };
421  int Spids[MAXSPIDS + 1] = { 0 };
422  uchar SubtitlingTypes[MAXSPIDS + 1] = { 0 };
423  uint16_t CompositionPageIds[MAXSPIDS + 1] = { 0 };
424  uint16_t AncillaryPageIds[MAXSPIDS + 1] = { 0 };
425  char ALangs[MAXAPIDS][MAXLANGCODE2] = { "" };
426  char DLangs[MAXDPIDS][MAXLANGCODE2] = { "" };
427  char SLangs[MAXSPIDS][MAXLANGCODE2] = { "" };
428  int Tpid = 0;
429  int NumApids = 0;
430  int NumDpids = 0;
431  int NumSpids = 0;
432  for (SI::Loop::Iterator it; pmt.streamLoop.getNext(stream, it); ) {
433  bool ProcessCaDescriptors = false;
434  int esPid = stream.getPid();
435  switch (stream.getStreamType()) {
436  case 1: // STREAMTYPE_11172_VIDEO
437  case 2: // STREAMTYPE_13818_VIDEO
438  case 0x1B: // H.264
439  Vpid = esPid;
440  Ppid = pmt.getPCRPid();
441  Vtype = stream.getStreamType();
442  ProcessCaDescriptors = true;
443  break;
444  case 3: // STREAMTYPE_11172_AUDIO
445  case 4: // STREAMTYPE_13818_AUDIO
446  case 0x0F: // ISO/IEC 13818-7 Audio with ADTS transport syntax
447  case 0x11: // ISO/IEC 14496-3 Audio with LATM transport syntax
448  {
449  if (NumApids < MAXAPIDS) {
450  Apids[NumApids] = esPid;
451  Atypes[NumApids] = stream.getStreamType();
452  SI::Descriptor *d;
453  for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) {
454  switch (d->getDescriptorTag()) {
458  char *s = ALangs[NumApids];
459  int n = 0;
460  for (SI::Loop::Iterator it; ld->languageLoop.getNext(l, it); ) {
461  if (*ld->languageCode != '-') { // some use "---" to indicate "none"
462  if (n > 0)
463  *s++ = '+';
465  s += strlen(s);
466  if (n++ > 1)
467  break;
468  }
469  }
470  }
471  break;
472  default: ;
473  }
474  delete d;
475  }
476  NumApids++;
477  }
478  ProcessCaDescriptors = true;
479  }
480  break;
481  case 5: // STREAMTYPE_13818_PRIVATE
482  case 6: // STREAMTYPE_13818_PES_PRIVATE
483  //XXX case 8: // STREAMTYPE_13818_DSMCC
484  {
485  int dpid = 0;
486  int dtype = 0;
487  char lang[MAXLANGCODE1] = { 0 };
488  SI::Descriptor *d;
489  for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) {
490  switch (d->getDescriptorTag()) {
493  dpid = esPid;
494  dtype = d->getDescriptorTag();
495  ProcessCaDescriptors = true;
496  break;
498  if (NumSpids < MAXSPIDS) {
499  Spids[NumSpids] = esPid;
502  char *s = SLangs[NumSpids];
503  int n = 0;
504  for (SI::Loop::Iterator it; sd->subtitlingLoop.getNext(sub, it); ) {
505  if (sub.languageCode[0]) {
506  SubtitlingTypes[NumSpids] = sub.getSubtitlingType();
507  CompositionPageIds[NumSpids] = sub.getCompositionPageId();
508  AncillaryPageIds[NumSpids] = sub.getAncillaryPageId();
509  if (n > 0)
510  *s++ = '+';
512  s += strlen(s);
513  if (n++ > 1)
514  break;
515  }
516  }
517  NumSpids++;
518  }
519  break;
521  Tpid = esPid;
522  break;
526  }
527  break;
528  default: ;
529  }
530  delete d;
531  }
532  if (dpid) {
533  if (NumDpids < MAXDPIDS) {
534  Dpids[NumDpids] = dpid;
535  Dtypes[NumDpids] = dtype;
536  strn0cpy(DLangs[NumDpids], lang, MAXLANGCODE1);
537  NumDpids++;
538  }
539  }
540  }
541  break;
542  case 0x80: // STREAMTYPE_USER_PRIVATE
543  if (Setup.StandardCompliance == STANDARD_ANSISCTE) { // DigiCipher II VIDEO (ANSI/SCTE 57)
544  Vpid = esPid;
545  Ppid = pmt.getPCRPid();
546  Vtype = 0x02; // compression based upon MPEG-2
547  ProcessCaDescriptors = true;
548  break;
549  }
550  // fall through
551  case 0x81: // STREAMTYPE_USER_PRIVATE
552  if (Setup.StandardCompliance == STANDARD_ANSISCTE) { // ATSC A/53 AUDIO (ANSI/SCTE 57)
553  char lang[MAXLANGCODE1] = { 0 };
554  SI::Descriptor *d;
555  for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) {
556  switch (d->getDescriptorTag()) {
560  }
561  break;
562  default: ;
563  }
564  delete d;
565  }
566  if (NumDpids < MAXDPIDS) {
567  Dpids[NumDpids] = esPid;
568  Dtypes[NumDpids] = SI::AC3DescriptorTag;
569  strn0cpy(DLangs[NumDpids], lang, MAXLANGCODE1);
570  NumDpids++;
571  }
572  ProcessCaDescriptors = true;
573  break;
574  }
575  // fall through
576  case 0x82: // STREAMTYPE_USER_PRIVATE
577  if (Setup.StandardCompliance == STANDARD_ANSISCTE) { // STANDARD SUBTITLE (ANSI/SCTE 27)
578  //TODO
579  break;
580  }
581  // fall through
582  case 0x83 ... 0xFF: // STREAMTYPE_USER_PRIVATE
583  {
584  char lang[MAXLANGCODE1] = { 0 };
585  bool IsAc3 = false;
586  SI::Descriptor *d;
587  for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) {
588  switch (d->getDescriptorTag()) {
591  // http://www.smpte-ra.org/mpegreg/mpegreg.html
592  switch (rd->getFormatIdentifier()) {
593  case 0x41432D33: // 'AC-3'
594  IsAc3 = true;
595  break;
596  default:
597  //printf("Format identifier: 0x%08X (pid: %d)\n", rd->getFormatIdentifier(), esPid);
598  break;
599  }
600  }
601  break;
605  }
606  break;
607  default: ;
608  }
609  delete d;
610  }
611  if (IsAc3) {
612  if (NumDpids < MAXDPIDS) {
613  Dpids[NumDpids] = esPid;
614  Dtypes[NumDpids] = SI::AC3DescriptorTag;
615  strn0cpy(DLangs[NumDpids], lang, MAXLANGCODE1);
616  NumDpids++;
617  }
618  ProcessCaDescriptors = true;
619  }
620  }
621  break;
622  default: ;//printf("PID: %5d %5d %2d %3d %3d\n", pmt.getServiceId(), stream.getPid(), stream.getStreamType(), pmt.getVersionNumber(), Channel->Number());
623  }
624  if (ProcessCaDescriptors) {
626  CaDescriptors->AddCaDescriptor(d, esPid);
627  delete d;
628  }
629  }
630  }
631  if (Setup.UpdateChannels >= 2) {
632  Channel->SetPids(Vpid, Ppid, Vtype, Apids, Atypes, ALangs, Dpids, Dtypes, DLangs, Spids, SLangs, Tpid);
633  Channel->SetCaIds(CaDescriptors->CaIds());
634  Channel->SetSubtitlingDescriptors(SubtitlingTypes, CompositionPageIds, AncillaryPageIds);
635  }
636  Channel->SetCaDescriptors(CaDescriptorHandler.AddCaDescriptors(CaDescriptors));
637  }
638  Channels.Unlock();
639  }
640  if (timer.TimedOut()) {
641  if (pmtIndex >= 0)
642  DBGLOG("PMT timeout %d", pmtIndex);
643  SwitchToNextPmtPid();
644  timer.Set(PMT_SCAN_TIMEOUT);
645  }
646 }
#define DBGLOG(a...)
Definition: pat.c:298
unsigned char uchar
Definition: tools.h:30
#define STANDARD_ANSISCTE
Definition: config.h:71
cChannels Channels
Definition: channels.c:810
#define dsyslog(a...)
Definition: tools.h:36
int StandardCompliance
Definition: config.h:284
int esPid
Definition: pat.c:24
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:354
void AddCaId(int CaId)
Definition: pat.c:123
StructureLoop< Association > associationLoop
Definition: section.h:39
uchar * data
Definition: pat.c:26
StructureLoop< Stream > streamLoop
Definition: section.h:71
int getCaPid() const
Definition: descriptor.c:350
char * strn0cpy(char *dest, const char *src, size_t n)
Definition: tools.c:131
DescriptorLoop commonDescriptors
Definition: section.h:70
CharArray privateData
Definition: descriptor.h:147
cPatFilter(void)
Definition: pat.c:301
DescriptorTag getDescriptorTag() const
Definition: si.c:100
int getServiceId() const
Definition: section.c:57
StructureLoop< Subtitling > subtitlingLoop
Definition: descriptor.h:331
int Count(void) const
Definition: tools.h:485
int GetCaDescriptors(const int *CaSystemIds, int BufSize, uchar *Data, int EsPid)
Definition: pat.c:162
void AddCaDescriptor(SI::CaDescriptor *d, int EsPid)
Definition: pat.c:135
int Transponder(void) const
Returns the transponder frequency in MHz, plus the polarization in case of sat.
Definition: channels.c:157
int GetPmtPid(int Source, int Transponder, int ServiceId)
Definition: pat.c:265
cCaDescriptors(int Source, int Transponder, int ServiceId, int PmtPid)
Definition: pat.c:90
int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids)
Definition: pat.c:255
int getPid() const
Definition: section.c:65
int CaSystem(void)
Definition: pat.c:31
#define MALLOC(type, size)
Definition: tools.h:46
int getPid() const
Definition: section.c:34
#define PMT_SCAN_TIMEOUT
Definition: pat.c:16
void Unlock(void)
Definition: thread.c:170
int Length(void) const
Definition: pat.c:34
void Trigger(int Sid=-1)
Definition: pat.c:315
T * Next(const T *object) const
Definition: tools.h:495
int getCaType() const
Definition: descriptor.c:346
int Source(void) const
Definition: channels.h:152
#define MAXPMTENTRIES
Definition: pat.h:17
int numCaIds
Definition: pat.c:73
cListObject * Next(void) const
Definition: tools.h:468
int getTableIdExtension() const
Definition: si.c:72
bool Is(int Source, int Transponder, int ServiceId)
Definition: pat.c:113
int getFormatIdentifier() const
Definition: descriptor.c:1179
int GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, uchar *Data, int EsPid)
Gets all CA descriptors for a given channel.
Definition: pat.c:277
void SwitchToNextPmtPid(void)
Definition: pat.c:345
void SetCaDescriptors(int Level)
Definition: channels.c:450
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:287
cSetup Setup
Definition: config.c:372
bool Lock(bool Write, int TimeoutMs=0)
Definition: thread.c:155
StructureLoop< Language > languageLoop
Definition: descriptor.h:489
int source
Definition: pat.c:69
int GetCaPids(const int *CaSystemIds, int BufSize, int *Pids)
Definition: pat.c:188
Definition: thread.h:63
cChannel * GetByServiceID(int Source, int Transponder, unsigned short ServiceID)
Definition: channels.c:924
int AddCaDescriptors(cCaDescriptors *CaDescriptors)
Definition: pat.c:227
#define MAXLANGCODE1
Definition: channels.h:40
void SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *CompositionPageIds, uint16_t *AncillaryPageIds)
Definition: channels.c:408
const int GetPmtPid(void)
Definition: pat.c:86
int getStreamType() const
Definition: section.c:69
#define MAXLANGCODE2
Definition: channels.h:41
bool CheckCRCAndParse()
Definition: si.c:65
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
Definition: pat.c:307
bool isNITPid() const
Definition: section.h:31
int getServiceId() const
Definition: section.c:30
int GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, uchar *Data, int EsPid)
Definition: pat.c:245
virtual ~cCaDescriptor()
Definition: pat.c:55
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
Definition: filter.c:104
#define MAXDPIDS
Definition: channels.h:36
T * First(void) const
Definition: tools.h:492
cList< cCaDescriptor > caDescriptors
Definition: pat.c:75
int getVersionNumber() const
Definition: si.c:84
int caSystem
Definition: pat.c:22
bool Empty(void)
Definition: pat.c:82
unsigned char u_char
Definition: headers.h:24
int getPCRPid() const
Definition: section.c:61
int UpdateChannels
Definition: config.h:313
bool operator==(const cCaDescriptors &arg) const
Definition: pat.c:100
int serviceId
Definition: pat.c:71
DescriptorLoop streamDescriptors
Definition: section.h:63
int EsPid(void)
Definition: pat.c:33
int transponder
Definition: pat.c:70
#define MAXSPIDS
Definition: channels.h:37
int getLength() const
Definition: util.h:58
const int * CaIds(void)
Definition: pat.c:87
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:282
const uchar * Data(void) const
Definition: pat.c:35
cCaDescriptor(int CaSystem, int CaPid, int EsPid, int Length, const uchar *Data)
Definition: pat.c:38
int CaPid(void)
Definition: pat.c:32
bool PmtVersionChanged(int PmtPid, int Sid, int Version, bool SetNewVersion=false)
Definition: pat.c:327
#define MAXCAIDS
Definition: channels.h:38
void 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:340
int Sid(void) const
Definition: channels.h:176
bool operator==(const cCaDescriptor &arg) const
Definition: pat.c:60
const char * I18nNormalizeLanguageCode(const char *Code)
Returns a 3 letter language code that may not be zero terminated.
Definition: i18n.c:238
int pmtPid
Definition: pat.c:72
const unsigned char * getData() const
Definition: util.h:51
void SetCaIds(const int *CaIds)
Definition: channels.c:429
Descriptor * getNext(Iterator &it)
Definition: si.c:112
cCaDescriptorHandler CaDescriptorHandler
Definition: pat.c:275
cMutex mutex
Definition: pat.c:216
int caPid
Definition: pat.c:23
int length
Definition: pat.c:25
#define MAXAPIDS
Definition: channels.h:35