-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloadepg.h
251 lines (226 loc) · 5.94 KB
/
loadepg.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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
//#include <vdr/plugin.h>
//#include <vdr/device.h>
//#include <vdr/remote.h>
//#include <vdr/thread.h>
#include <getopt.h>
#include <sys/ioctl.h>
#include <linux/dvb/frontend.h>
#include <linux/dvb/dmx.h>
//#include "../../../libsi/section.h"
#include "formats.h"
#include "i18n.h"
//#ifndef APIVERSNUM
//#include <vdr/config.h>
//#endif
#define DEBUG true
#define DEBUG_STARTTIME false
#define DVB_DEVICE_DEMUX "/dev/dvb/adapter%i/demux0"
#define LOADEPG_FILE_CONF "loadepg.conf"
#define LOADEPG_FILE_EQUIV "loadepg.equiv"
#define FILE_EPG_TMP "/tmp/epg.tmp"
#define FILE_EPG_ERR "/tmp/epg.err"
#define FILE_EPG_CHANNELS "/tmp/epg.channels"
#define MAX_FILTERS 24
#define MAX_ACTIVE_FILTERS 6
#define MAX_PROVIDERS 64
#define MAX_BOUQUETS 256
#define MAX_THEMES 4096
#define MAX_CHANNELS 4096
#define MAX_TITLES 262144
#define MAX_SUMMARIES 262144
#define MAX_BUFFER_SIZE_CHANNELS 1048576
#define MAX_BUFFER_SIZE_TITLES 4194304
#define MAX_BUFFER_SIZE_SUMMARIES 33554432
#define DATA_FORMAT_SKYBOX 1
#define DATA_FORMAT_MHW_1 2
#define DATA_FORMAT_MHW_2 3
#define DATA_FORMAT_FILE 4
#define DATA_FORMAT_SCRIPT 5
#define TIMEOUT_CONTROL 90 // seconds
#define TIMEOUT_FILTER 5000 // ms
#define TIMEOUT_ROTOR 30 // seconds
struct sNode
{
char *Value;
struct sNode *P0;
struct sNode *P1;
};
typedef struct sNode sNodeH;
typedef struct
{
char *Directory;
int DvbAdapterHasRotor;
int DvbAdapterNumber;
int EnableOsdMessages;
int UseFileEquivalents;
} sConfig;
typedef struct
{
unsigned short int OriginalSourceId;
unsigned short int OriginalNid;
unsigned short int OriginalTid;
unsigned short int OriginalSid;
unsigned short int OriginalRid;
unsigned short int EquivSourceId;
unsigned short int EquivNid;
unsigned short int EquivTid;
unsigned short int EquivSid;
unsigned short int EquivRid;
} sEquivChannel;
typedef struct
{
unsigned char Name[256];
} sTheme;
typedef struct
{
unsigned short int ChannelId;
unsigned short int Nid;
unsigned short int Tid;
unsigned short int Sid;
unsigned short int SkyNumber;
unsigned int pData;
unsigned int lenData;
bool IsFound;
bool IsEpg;
} sChannel;
typedef struct
{
unsigned short int BouquetId;
short int SectionNumber[256];
short int LastSectionNumber;
} sBouquet;
typedef struct
{
unsigned short int ChannelId;
unsigned short int ThemeId;
unsigned short int MjdTime;
unsigned short int EventId;
unsigned int StartTime;
unsigned int Duration;
unsigned char SummaryAvailable;
unsigned int pData;
unsigned int lenData;
} sTitle;
typedef struct
{
unsigned short int ChannelId;
unsigned short int MjdTime;
unsigned short int EventId;
unsigned int pData;
unsigned lenData;
} sSummary;
typedef struct
{
char *Title;
int DataFormat;
int SourceId;
char *Parm1;
char *Parm2;
char *Parm3;
} sProvider;
typedef struct
{
int Fd;
int Step;
unsigned short int Pid;
unsigned char Tid;
unsigned char Mask;
} sFilter;
typedef struct
{
int Fd;
int FilterId;
bool IsBusy;
} sActiveFilter;
class cControlLoadepg :
{
private:
protected:
virtual void Action( void );
public:
cControlLoadepg( void );
~cControlLoadepg();
bool Loading;
bool Stopping;
bool Error;
};
class cTaskLoadepg :
{
private:
int SetupUpdateChannels;
int DvbAdapterNumber;
cChannel *VdrChannel;
cChannel *EpgChannel;
cDevice *EpgDevice;
sNodeH H;
sNodeH *nH;
bool HasSwitched;
bool IsError;
bool IsRunning;
bool EndBAT;
bool EndThemes;
bool EndChannels;
int pC;
int pT;
int pS;
struct pollfd PFD[MAX_FILTERS];
int nFilters;
sFilter Filters[MAX_FILTERS];
int nActiveFilters;
sActiveFilter ActiveFilters[MAX_ACTIVE_FILTERS];
unsigned char InitialBuffer[MAX_FILTERS][64];
void AddFilter( unsigned short int Pid, unsigned char Tid = 0x00, unsigned char Mask = 0xff );
void StartFilter( int FilterId );
void StopFilter( int ActiveFilterId );
void PollingFilters( int Timeout );
void ReadBuffer( int FilterId, int Fd );
void GetLocalTimeOffset( void );
void GetSatelliteTimeOffset( int FilterId, unsigned char *Data, int Length );
void GetChannelsSKYBOX( int FilterId, unsigned char *Data, int Length );
void GetTitlesSKYBOX( int FilterId, unsigned char *Data, int Length );
void GetSummariesSKYBOX( int FilterId, unsigned char *Data, int Length );
void GetThemesMHW1( int FilterId, unsigned char *Data, int Length );
void GetChannelsMHW1( int FilterId, unsigned char *Data, int Length );
void GetTitlesMHW1( int FilterId, unsigned char *Data, int Length );
void GetSummariesMHW1( int FilterId, unsigned char *Data, int Length );
void GetThemesMHW2( int FilterId, unsigned char *Data, int Length );
void GetChannelsMHW2( int FilterId, unsigned char *Data, int Length );
void GetTitlesMHW2( int FilterId, unsigned char *Data, int Length );
void GetSummariesMHW2( int FilterId, unsigned char *Data, int Length );
void CreateEpgDataFile( void );
bool ReadFileDictionary( void );
bool ReadFileThemes( void );
void CleanString( unsigned char *String );
unsigned char DecodeText[4096];
unsigned char DecodeErrorText[4096];
int DecodeHuffmanCode( unsigned char *Data, int Length );
void CreateFileChannels( const char *FileChannels );
protected:
virtual void Action( void );
public:
cTaskLoadepg( void );
~cTaskLoadepg();
void LoadFromSatellite( void );
void LoadFromFile( const char *FileEpg );
void LoadFromScript( const char *FileScript, const char *FileEpg );
};
class cMainMenuLoadepg : public cOsdMenu
{
private:
protected:
public:
cMainMenuLoadepg( void );
~cMainMenuLoadepg();
eOSState ProcessKey( eKeys Key );
};
class cSetupMenuLoadepg : public cMenuSetupPage
{
private:
const char *dvbAdapterNumberFormatTexts[8];
const char *dvbAdapterHasRotorFormatTexts[8];
protected:
virtual void Store( void );
public:
cSetupMenuLoadepg( void );
~cSetupMenuLoadepg();
};