summaryrefslogtreecommitdiff
path: root/pat.h
blob: 86999a537e5d6d5439a96ce0ebfd22d8a34915c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
 * pat.h: PAT section filter
 *
 * See the main source file 'vdr.c' for copyright information and
 * how to reach the author.
 *
 * $Id: pat.h 5.2 2021/06/11 09:38:38 kls Exp $
 */

#ifndef __PAT_H
#define __PAT_H

#include <stdint.h>
#include "filter.h"
#include "thread.h"

class cPmtPidEntry;
class cPmtSidEntry;
class cPmtSidRequest;

class cPatFilter : public cFilter {
private:
  cMutex mutex;
  cTimeMs timer;
  int patVersion;
  cPmtPidEntry *activePmt;
  cList<cPmtPidEntry> pmtPidList;
  cList<cPmtSidEntry> pmtSidList;
  cList<cPmtSidRequest> pmtSidRequestList;
  int source;
  int transponder;
  cSectionSyncer sectionSyncer;
  bool TransponderChanged(void);
  bool PmtPidComplete(int PmtPid);
  void PmtPidReset(int PmtPid);
  bool PmtVersionChanged(int PmtPid, int Sid, int Version, bool SetNewVersion = false);
  int  NumSidRequests(int Sid);
  void SwitchToNextPmtPid(void);
protected:
  virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length);
public:
  cPatFilter(void);
  virtual void SetStatus(bool On);
  void Trigger(int); // triggers reading the PMT PIDs that are currently not requested (dummy parameter for backwards compatibility, value is ignored)
  void Request(int Sid); // requests permanent reading of the PMT PID for this SID
  void Release(int Sid); // releases permanent reading of the PMT PID for this SID
  };

void GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSystemIds, cDynamicBuffer &Buffer, int EsPid);
         ///< Gets all CA descriptors for a given channel.
         ///< Copies all available CA descriptors for the given Source, Transponder and ServiceId
         ///< into the provided buffer. Only those CA descriptors
         ///< are copied that match one of the given CA system IDs (or all of them, if CaSystemIds
         ///< is 0xFFFF).

int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, int *Pids);
         ///< Gets all CA pids for a given channel.
         ///< Copies all available CA pids from the CA descriptors for the given Source, Transponder and ServiceId
         ///< into the provided buffer at Pids (at most BufSize - 1 entries, the list will be zero-terminated).
         ///< Only the CA pids of those CA descriptors are copied that match one of the given CA system IDs
         ///< (or all of them, if CaSystemIds is 0xFFFF).
         ///< Returns the number of pids copied into Pids (0 if no CA descriptors are
         ///< available), or -1 if BufSize was too small to hold all CA pids.

int GetPmtPid(int Source, int Transponder, int ServiceId);
         ///< Gets the Pid of the PMT in which the CA descriptors for this channel are defined.

#endif //__PAT_H