forked from wirbel-at-vdr-portal/wirbelscan-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscanfilter.h
231 lines (204 loc) · 6.08 KB
/
scanfilter.h
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/*******************************************************************************
* wirbelscan: A plugin for the Video Disk Recorder
* See the README file for copyright information and how to reach the author.
******************************************************************************/
#pragma once
#include <string>
#include <cstdint> // uint{8.16,32}_t
#include <atomic> // std::atomic<bool>
#include <vdr/thread.h> // cCondWait
#include <vdr/sections.h> // cSectionSyncer
#include "tlist.h" // TList<T>
#include "common.h" // TPid
/*******************************************************************************
* forward decls
******************************************************************************/
class cDevice;
class TChannel;
extern int nextTransponders;
bool known_transponder(TChannel* newChannel, bool auto_allowed, TChannels* list = nullptr);
bool is_nearly_same_frequency(const TChannel* chan_a, const TChannel* chan_b, unsigned delta = 2001);
bool is_different_transponder_deep_scan(const TChannel* a, const TChannel* b, bool auto_allowed);
TChannel* GetByTransponder(const TChannel* Transponder);
void resetLists(void);
/*******************************************************************************
* class cTransponders
******************************************************************************/
class cTransponders : public TChannels {
private:
protected:
public:
bool IsUniqueTransponder(const TChannel* NewTransponder);
TChannel* GetByParams(const TChannel* NewTransponder);
TChannel* NextTransponder(void);
};
struct service {
uint16_t transport_stream_id;
uint16_t program_map_PID;
uint16_t program_number;
};
struct TPatData {
uint16_t network_PID;
TList<struct service> services;
};
struct TPmtData {
uint16_t program_map_PID;
uint16_t program_number;
uint16_t PCR_PID;
TPid Vpid;
int Tpid;
TList<TPid> Apids;
TList<TPid> Dpids;
TList<TPid> Spids;
TList<int> Caids;
};
struct TCell {
uint16_t network_id;
uint16_t cell_id;
uint32_t frequency;
uint8_t subcellcount;
struct {
uint8_t cell_id_extension;
uint32_t transposer_frequency;
} subcells[51];
};
struct TServiceListItem {
uint16_t network_id;
uint16_t original_network_id;
uint16_t transport_stream_id;
uint16_t service_id;
uint16_t service_type;
};
struct TFrequencyListItem {
uint16_t network_id;
uint32_t frequency;
};
struct TChannelListItem {
uint16_t network_id;
uint16_t original_network_id;
uint16_t transport_stream_id;
uint16_t service_id;
int channel_list_id;
bool HD_simulcast;
int LCN;
int LCN_minor;
bool operator <(const TChannelListItem& rhs);
bool operator==(const TChannelListItem& rhs);
};
// returns true, if GetLCN() assigned a new LCN to 'c'.
bool GetLCN(TChannel* c);
struct TNitData {
int OrbitalPos;
bool West;
TList<TFrequencyListItem> frequency_list;
TList<TCell> cell_frequency_links;
TList<TServiceListItem> service_types;
TList<TChannel*> transport_streams;
};
struct sdtservice {
uint16_t transport_stream_id;
uint16_t original_network_id;
uint16_t service_id;
uint16_t service_type;
bool free_CA_mode;
std::string Name;
std::string Shortname;
std::string Provider;
bool reported;
};
struct TSdtData {
uint16_t original_network_id;
TList<sdtservice> services;
};
/*******************************************************************************
* class cPatScanner
******************************************************************************/
class cPatScanner : public ThreadBase {
private:
cDevice* device;
struct TPatData& PatData;
std::atomic<bool> isActive;
cSectionSyncer Sync;
std::string s;
cCondWait wait;
TChannel channel;
std::atomic<bool> hasPAT;
bool anyBytes;
protected:
virtual void Process(const unsigned char* Data, int Length);
virtual void Action(void);
public:
cPatScanner(cDevice* Parent, struct TPatData& Dest);
~cPatScanner();
bool HasPAT(void) { return hasPAT; };
bool Active(void) { return isActive; };
};
/*******************************************************************************
* class cPmtScanner
******************************************************************************/
class cPmtScanner : public ThreadBase {
private:
cDevice* device;
TPmtData* data;
std::atomic<bool> isActive;
std::atomic<bool> jobDone;
std::string s;
cCondWait wait;
protected:
virtual void Process(const unsigned char* Data, int Length);
virtual void Action(void);
public:
cPmtScanner(cDevice* Parent, TPmtData* Data);
~cPmtScanner();
bool Active(void) { return isActive; };
bool Finished(void) { return jobDone; };
};
/*******************************************************************************
* class cNitScanner
******************************************************************************/
class cNitScanner : public ThreadBase {
private:
std::atomic<bool> active;
cDevice* device;
uint16_t nit;
std::string s;
cCondWait wait;
TNitData& data;
uint32_t first_crc32;
int type;
std::atomic<bool> hasNIT;
bool west;
uint16_t orbital;
bool anyBytes;
void ParseCellFrequencyLinks(uint16_t network_id, const unsigned char* Data, TList<TCell>& list);
protected:
virtual void Process(const unsigned char* Data, int Length);
virtual void Action(void);
public:
cNitScanner(cDevice* Parent, uint16_t network_PID, TNitData& Data, int Type);
~cNitScanner();
bool Active(void) { return (active); };
bool HasNIT(void) { return hasNIT; };
};
/*******************************************************************************
* class cSdtScanner
******************************************************************************/
class cSdtScanner : public ThreadBase {
private:
std::atomic<bool> active;
cDevice* device;
TSdtData& data;
std::string s;
cCondWait wait;
uint32_t first_crc32;
std::atomic<bool> hasSDT;
bool anyBytes;
protected:
virtual void Process(const unsigned char* Data, int Length);
virtual void Action(void);
public:
cSdtScanner(cDevice* Parent, TSdtData& Data);
~cSdtScanner();
bool Active(void) { return active; };
bool SdtNIT(void) { return hasSDT; };
};