openATV enigma2
openATV is an open source SetTopBox Graphical user interface.
epgchanneldata.h
Go to the documentation of this file.
1 #ifndef __epgchanneldata_h_
2 #define __epgchanneldata_h_
3 
4 #include <lib/dvb/eit.h>
5 #include <lib/dvb/epgcache.h>
6 #include <lib/dvb/lowlevel/eit.h>
7 #include <lib/base/ebase.h>
8 
9 #ifdef ENABLE_MHW_EPG
10 #include <lib/dvb/lowlevel/mhw.h>
11 #endif
12 #ifdef ENABLE_FREESAT
13 #include <bitset>
14 class freesatEITSubtableStatus;
15 #endif
16 
17 #define MjdToEpochTime(x) (((x##_hi << 8 | x##_lo)-40587)*86400)
18 #define BcdTimeToSeconds(x) ((3600 * ((10*((x##_h & 0xF0)>>4)) + (x##_h & 0xF))) + (60 * ((10*((x##_m & 0xF0)>>4)) + (x##_m & 0xF))) + ((10*((x##_s & 0xF0)>>4)) + (x##_s & 0xF)))
19 
20 #ifdef ENABLE_MHW_EPG
21 
22 #define FILE_EQUIV "/etc/mhw_Equiv.epg"
23 #define FILE_CHANNELS "/etc/mhw_Chann.epg"
24 #define FILE_LOG "/tmp/mhw_Log.epg"
25 
26 #define EPG_REPLAY_LEN 8
27 
28 typedef struct epg_replay {
29  u_char channel_id :8;
30  u_char replay_mjd_hi :8;
31  u_char replay_mjd_lo :8;
32  u_char replay_time_h :8;
33  u_char replay_time_m :8;
34  u_char replay_time_s :8;
35  u_char reserv1 :8;
36 #if BYTE_ORDER == BIG_ENDIAN
37  u_char last :1;
38  u_char :1;
39  u_char vo :1;
40  u_char vm :1;
41  u_char :3;
42  u_char subtitles :1;
43 #else
44  u_char subtitles :1;
45  u_char :3;
46  u_char vm :1;
47  u_char vo :1;
48  u_char :1;
49  u_char last :1;
50 #endif
51 } epg_replay_t;
52 
53 typedef struct {
54  u_char original_nid_hi;
55  u_char original_nid_lo;
56  u_char original_tid_hi;
57  u_char original_tid_lo;
58  u_char original_sid_hi;
59  u_char original_sid_lo;
60  u_char equiv_nid_hi;
61  u_char equiv_nid_lo;
62  u_char equiv_tid_hi;
63  u_char equiv_tid_lo;
64  u_char equiv_sid_hi;
65  u_char equiv_sid_lo;
66 } mhw_channel_equiv_t;
67 #endif
68 
69 typedef std::set<uint32_t> tidMap;
70 
72 struct uniqueEPGKey;
73 
74 class eEPGChannelData: public sigc::trackable
75 {
77  friend class eEPGCache;
78 
79  pthread_mutex_t channel_active;
81  eEPGTransponderDataReader *epgReader;
82  ePtr<eTimer> abortTimer, zapTimer;
83  int prevChannelState;
84  int state;
85  unsigned int isRunning, haveData;
86  ePtr<eDVBChannel> channel;
87  ePtr<eConnection> m_stateChangedConn, m_NowNextConn, m_ScheduleConn, m_ScheduleOtherConn, m_ViasatConn;
88  ePtr<iDVBSectionReader> m_NowNextReader, m_ScheduleReader, m_ScheduleOtherReader, m_ViasatReader;
89  tidMap seenSections[4], calcedSections[4];
90 #ifdef ENABLE_VIRGIN
91  ePtr<eConnection> m_VirginNowNextConn, m_VirginScheduleConn;
92  ePtr<iDVBSectionReader> m_VirginNowNextReader, m_VirginScheduleReader;
93 #endif
94 #ifdef ENABLE_NETMED
95  ePtr<eConnection> m_NetmedScheduleConn, m_NetmedScheduleOtherConn;
96  ePtr<iDVBSectionReader> m_NetmedScheduleReader, m_NetmedScheduleOtherReader;
97 #endif
98 #ifdef ENABLE_FREESAT
99  ePtr<eConnection> m_FreeSatScheduleOtherConn, m_FreeSatScheduleOtherConn2;
100  ePtr<iDVBSectionReader> m_FreeSatScheduleOtherReader, m_FreeSatScheduleOtherReader2;
101  std::map<uint32_t, freesatEITSubtableStatus> m_FreeSatSubTableStatus;
102  uint32_t m_FreesatTablesToComplete;
103  void readFreeSatScheduleOtherData(const uint8_t *data);
104  void cleanupFreeSat();
105 #endif
106 #ifdef ENABLE_PRIVATE_EPG
107  ePtr<eTimer> startPrivateTimer;
108  int m_PrevVersion;
109  int m_PrivatePid;
110  uniqueEPGKey m_PrivateService;
111  ePtr<eConnection> m_PrivateConn;
112  ePtr<iDVBSectionReader> m_PrivateReader;
113  std::set<uint8_t> seenPrivateSections;
114  void readPrivateData(const uint8_t *data);
115  void startPrivateReader();
116 #endif
117 #ifdef ENABLE_MHW_EPG
118  std::vector<mhw_channel_name_t> m_channels;
119  std::vector<mhw_channel_equiv_t> m_equiv;
120  std::map<uint8_t, mhw_theme_name_t> m_themes;
121  std::map<uint32_t, mhw_title_t> m_titles;
122  std::multimap<uint32_t, uint32_t> m_program_ids;
123  ePtr<eConnection> m_MHWConn, m_MHWConn2;
124  ePtr<iDVBSectionReader> m_MHWReader, m_MHWReader2;
125  eDVBSectionFilterMask m_MHWFilterMask, m_MHWFilterMask2;
126  ePtr<eTimer> m_MHWTimeoutTimer;
127  uint16_t m_mhw2_channel_pid, m_mhw2_title_pid, m_mhw2_summary_pid;
128  bool m_MHWTimeoutet;
129  void MHWTimeout() { m_MHWTimeoutet=true; }
130  void readMHWData(const uint8_t *data);
131  void readMHWData2(const uint8_t *data);
132  void readMHWData2_old(const uint8_t *data);
133  void startMHWReader(uint16_t pid, uint8_t tid);
134  void startMHWReader2(uint16_t pid, uint8_t tid, int ext=-1);
135  void startMHWTimeout(int msek);
136  bool checkMHWTimeout() { return m_MHWTimeoutet; }
137  void cleanupMHW();
138  uint8_t *delimitName( uint8_t *in, uint8_t *out, int len_in );
139  void timeMHW2DVB( u_char hours, u_char minutes, u_char *return_time);
140  void timeMHW2DVB( int minutes, u_char *return_time);
141  void timeMHW2DVB( u_char day, u_char hours, u_char minutes, u_char *return_time);
142  void storeMHWTitle(std::map<uint32_t, mhw_title_t>::iterator itTitle, std::string sumText, const uint8_t *data);
143  void GetEquiv(void);
144  int nb_equiv;
145  bool log_open ();
146  void log_close();
147  void log_add (const char *message, ...);
148 #endif
149 #ifdef ENABLE_ATSC
150  int m_atsc_eit_index;
151  std::map<uint16_t, uint16_t> m_ATSC_VCT_map;
152  std::map<uint32_t, std::string> m_ATSC_ETT_map;
153  struct atsc_event
154  {
155  uint16_t eventId;
156  uint32_t startTime;
157  uint32_t lengthInSeconds;
158  std::string title;
159  };
160  std::map<uint32_t, struct atsc_event> m_ATSC_EIT_map;
161  ePtr<iDVBSectionReader> m_ATSC_VCTReader, m_ATSC_MGTReader, m_ATSC_EITReader, m_ATSC_ETTReader;
162  ePtr<eConnection> m_ATSC_VCTConn, m_ATSC_MGTConn, m_ATSC_EITConn, m_ATSC_ETTConn;
163  void ATSC_checkCompletion();
164  void ATSC_VCTsection(const uint8_t *d);
165  void ATSC_MGTsection(const uint8_t *d);
166  void ATSC_EITsection(const uint8_t *d);
167  void ATSC_ETTsection(const uint8_t *d);
168  void cleanupATSC();
169 #endif
170 #ifdef ENABLE_OPENTV
171  typedef std::tr1::unordered_map<uint32_t, std::string> OpenTvDescriptorMap;
172  int m_OPENTV_EIT_index;
173  uint16_t m_OPENTV_pid;
174  uint32_t m_OPENTV_crc32;
175  uint32_t opentv_title_crc32;
176  bool huffman_dictionary_read;
177  struct opentv_channel
178  {
179  uint16_t originalNetworkId;
180  uint16_t transportStreamId;
181  uint16_t serviceId;
182  uint8_t serviceType;
183  };
184  struct opentv_event
185  {
186  uint16_t eventId;
187  uint32_t startTime;
188  uint32_t duration;
189  uint32_t title_crc;
190  };
191  OpenTvDescriptorMap m_OPENTV_descriptors_map;
192  std::map<uint16_t, struct opentv_channel> m_OPENTV_channels_map;
193  std::map<uint32_t, struct opentv_event> m_OPENTV_EIT_map;
194  ePtr<eTimer> m_OPENTV_Timer;
195  ePtr<iDVBSectionReader> m_OPENTV_ChannelsReader, m_OPENTV_TitlesReader, m_OPENTV_SummariesReader;
196  ePtr<eConnection> m_OPENTV_ChannelsConn, m_OPENTV_TitlesConn, m_OPENTV_SummariesConn;
197  void OPENTV_checkCompletion(const uint32_t data_crc);
198  void OPENTV_ChannelsSection(const uint8_t *d);
199  void OPENTV_TitlesSection(const uint8_t *d);
200  void OPENTV_SummariesSection(const uint8_t *d);
201  void cleanupOPENTV();
202 #endif
203  void readData(const uint8_t *data, int source);
204  void startChannel();
205  void startEPG();
206  void finishEPG();
207  void abortEPG();
208  void abortNonAvail();
209 };
210 #endif
Definition: epgcache.h:113
friend class eEPGChannelData
Definition: epgcache.h:142
Definition: epgchanneldata.h:75
Definition: epgtransponderdatareader.h:52
std::set< uint32_t > tidMap
Definition: epgchanneldata.h:69
unsigned char data[256]
Definition: hdmi_cec.h:2
source
Definition: enigma_py_patcher.py:9
Definition: idvb.h:24
Definition: epgcache.h:30