openATV enigma2
openATV is an open source SetTopBox Graphical user interface.
pmt.h
Go to the documentation of this file.
1 #ifndef __lib_dvb_dvbmid_h
2 #define __lib_dvb_dvbmid_h
3 
4 #ifndef SWIG
5 #include <map>
6 #include <lib/base/buffer.h>
7 #include <lib/dvb/idvb.h>
8 #include <lib/dvb/dvb.h>
9 #include <lib/dvb/idemux.h>
10 #include <lib/dvb/esection.h>
11 #include <lib/dvb/cahandler.h>
12 #include <lib/dvb/pmtparse.h>
13 #include <lib/python/python.h>
14 
15 #include <sys/socket.h>
16 #include <sys/types.h>
17 #include <sys/un.h>
18 #include <unistd.h>
19 #include <fcntl.h>
20 
21 class eDVBScan;
22 
23 #endif
24 
25 class OCSection : public LongCrcSection
26 {
27  protected:
28  void *data;
29 
30  public:
31  OCSection(const uint8_t * const buffer)
32  : LongCrcSection(buffer)
33  {
34  data = malloc(getSectionLength());
35  memcpy(data, buffer, getSectionLength());
36  }
38  {
39  free(data);
40  }
41  void *getData() { return data; }
42 };
43 
44 #include <list>
45 #include <string>
47 {
48 public:
49  int m_OrgId;
50  int m_AppId;
53  std::string m_HbbTVUrl;
54  std::string m_ApplicationName;
55 public:
56  HbbTVApplicationInfo(int controlCode, int orgid, int appid, std::string hbbtvUrl, std::string applicationName,int profileCode)
57  : m_OrgId(orgid), m_AppId(appid), m_ControlCode(controlCode), m_ProfileCode(profileCode),
58  m_HbbTVUrl(hbbtvUrl), m_ApplicationName(applicationName)
59  {}
60 };
61 typedef std::list<HbbTVApplicationInfo *> HbbTVApplicationInfoList;
62 typedef HbbTVApplicationInfoList::iterator HbbTVApplicationInfoListIterator;
63 typedef HbbTVApplicationInfoList::const_iterator HbbTVApplicationInfoListConstIterator;
64 
66 {
67 #ifndef SWIG
68  friend class eDVBCAService;
69  friend class eRTSPStreamClient;
70  eServiceReferenceDVB m_reference;
71  ePtr<eDVBService> m_service;
72 
73  int m_last_channel_state;
74  eDVBCAService *m_ca_servicePtr;
75  ePtr<eDVBScan> m_dvb_scan; // for sdt scan
76 
80 
82  eUsePtr<iDVBPVRChannel> m_pvr_channel;
83  ePtr<eDVBResourceManager> m_resourceManager;
84  ePtr<iDVBDemux> m_demux, m_pvr_demux_tmp;
85 
86  void channelStateChanged(iDVBChannel *);
87  ePtr<eConnection> m_channelStateChanged_connection;
88  void channelEvent(iDVBChannel *, int event);
89  ePtr<eConnection> m_channelEvent_connection;
90  void SDTScanEvent(int);
91  ePtr<eConnection> m_scan_event_connection;
92 
93  void registerCAService();
94 
95  void PMTready(int error);
96  void PATready(int error);
97  void AITready(int error);
98  void OCready(int error);
99 
100  int m_pmt_pid;
101  int m_dsmcc_pid;
102  int m_ait_pid;
103  HbbTVApplicationInfoList m_HbbTVApplications;
104  std::string m_HBBTVUrl;
105  std::string m_ApplicationName;
106  unsigned char m_AITData[4096];
107 
108  int m_use_decode_demux;
109  uint8_t m_decode_demux_num;
110  ePtr<eTimer> m_no_pat_entry_delay;
111 
112  bool m_pmt_ready;
113  bool m_ca_disabled;
114 public:
117 #endif
118 
119 #ifdef SWIG
120 private:
122 public:
123 #endif
124 
125  enum
126  {
127  eventNoResources, // a requested resource couldn't be allocated
128  eventTuneFailed, // tune failed
129  eventNoPAT, // no pat could be received (timeout)
130  eventNoPATEntry, // no pat entry for the corresponding SID could be found
131  eventNoPMT, // no pmt could be received (timeout)
132  eventNewProgramInfo, // we just received a PMT
133  eventTuned, // a channel was sucessfully (re-)tuned in, you may start additional filters now
134 
135  eventPreStart, // before start filepush thread
136  eventSOF, // seek pre start
137  eventEOF, // a file playback did end
138 
139  eventMisconfiguration, // a channel was not found in any list, or no frontend was found which could provide this channel
140 
141  eventHBBTVInfo, /* HBBTV information was detected in the AIT */
142 
145  };
146 #ifndef SWIG
147  sigc::signal1<void,int> serviceEvent;
148 
150  int getDataDemux(ePtr<iDVBDemux> &demux);
151  int getDecodeDemux(ePtr<iDVBDemux> &demux);
152  void getAITApplications(std::map<int, std::string> &aitlist);
153  void getCaIds(std::vector<int> &caids, std::vector<int> &ecmpids, std::vector<std::string> &ecmdatabytes);
154  PyObject *getHbbTVApplications();
155 
156  int getPVRChannel(ePtr<iDVBPVRChannel> &pvr_channel);
157  int getServiceReference(eServiceReferenceDVB &service) { service = m_reference; return 0; }
158  int getService(ePtr<eDVBService> &service) { service = m_service; return 0; }
160  int getChannel(eUsePtr<iDVBChannel> &channel);
161  int getDemuxID() const { return m_decode_demux_num; }
162  void resetCachedProgram() { m_have_cached_program = false; }
163  void sendEventNoPatEntry();
164  void getHBBTVUrl(std::string &ret) const { ret = m_HBBTVUrl; }
165  void setCaDisable(bool disable) { m_ca_disabled = disable; }
166  void addCaHandler();
167  void removeCaHandler();
168 
170  {
171  livetv = 0,
174  playback = 3,
181  offline = 10
182  };
183 
184  /* deprecated interface */
185  int tune(eServiceReferenceDVB &ref, int use_decode_demux, eCueSheet *sg=0, bool simulate=false, eDVBService *service = 0, serviceType type = livetv, bool descramble = true);
186 
187  /* new interface */
188  int tuneExt(eServiceReferenceDVB &ref, ePtr<iTsSource> &, const char *streaminfo_file, eCueSheet *sg=0, bool simulate=false, eDVBService *service = 0, serviceType type = livetv, bool descramble = true);
189 
190  void free();
191 private:
192  bool m_have_cached_program;
193  program m_cached_program;
194  serviceType m_service_type;
195 
196  struct aitInfo
197  {
198  int id;
199  std::string url;
200  std::string name;
201  };
202  std::vector<struct aitInfo> m_aitInfoList;
203  int compareAudioSubtitleCode(const std::string &subtitleTrack, const std::string &audioTrack);
204 #endif
205 };
206 
207 #endif
static int ptr
Definition: bcm.cpp:17
Definition: pmt.h:47
int m_ControlCode
Definition: pmt.h:51
int m_OrgId
Definition: pmt.h:49
std::string m_ApplicationName
Definition: pmt.h:54
int m_AppId
Definition: pmt.h:50
std::string m_HbbTVUrl
Definition: pmt.h:53
HbbTVApplicationInfo(int controlCode, int orgid, int appid, std::string hbbtvUrl, std::string applicationName, int profileCode)
Definition: pmt.h:56
short m_ProfileCode
Definition: pmt.h:52
Definition: pmt.h:26
void * getData()
Definition: pmt.h:41
void * data
Definition: pmt.h:28
~OCSection()
Definition: pmt.h:37
OCSection(const uint8_t *const buffer)
Definition: pmt.h:31
Definition: esection.h:104
RESULT getCurrent(ePtr< Table > &ptr)
Definition: esection.h:175
Definition: idvb.h:695
Definition: cahandler.h:103
Definition: pmtparse.h:14
eAUTable< eTable< ProgramMapSection > > m_PMT
Definition: pmtparse.h:16
Definition: dvb/scan.h:27
Definition: idvb.h:323
Definition: pmt.h:66
void sendEventNoPatEntry()
Definition: pmt.cpp:207
@ eventTuneFailed
Definition: pmt.h:128
@ eventNewProgramInfo
Definition: pmt.h:132
@ eventMisconfiguration
Definition: pmt.h:139
@ eventPreStart
Definition: pmt.h:135
@ eventHBBTVInfo
Definition: pmt.h:141
@ eventNoResources
Definition: pmt.h:127
@ eventEOF
Definition: pmt.h:137
@ eventStopped
Definition: pmt.h:143
@ eventNoPMT
Definition: pmt.h:131
@ eventNoPAT
Definition: pmt.h:129
@ eventSOF
Definition: pmt.h:136
@ eventChannelAllocated
Definition: pmt.h:144
@ eventNoPATEntry
Definition: pmt.h:130
@ eventTuned
Definition: pmt.h:133
int getPVRChannel(ePtr< iDVBPVRChannel > &pvr_channel)
Definition: pmt.cpp:989
int getChannel(eUsePtr< iDVBChannel > &channel)
Definition: pmt.cpp:951
int getDecodeDemux(ePtr< iDVBDemux > &demux)
Definition: pmt.cpp:969
int tuneExt(eServiceReferenceDVB &ref, ePtr< iTsSource > &, const char *streaminfo_file, eCueSheet *sg=0, bool simulate=false, eDVBService *service=0, serviceType type=livetv, bool descramble=true)
Definition: pmt.cpp:1042
void setCaDisable(bool disable)
Definition: pmt.h:165
void free()
Definition: pmt.cpp:1169
serviceType
Definition: pmt.h:170
@ playback
Definition: pmt.h:174
@ livetv
Definition: pmt.h:171
@ scrambled_streamserver
Definition: pmt.h:179
@ timeshift_recording
Definition: pmt.h:175
@ scrambled_recording
Definition: pmt.h:173
@ recording
Definition: pmt.h:172
@ streamserver
Definition: pmt.h:178
@ scrambled_timeshift_recording
Definition: pmt.h:176
@ streamclient
Definition: pmt.h:180
@ offline
Definition: pmt.h:181
@ timeshift_playback
Definition: pmt.h:177
int getProgramInfo(program &program)
Definition: pmt.cpp:540
int getPMT(ePtr< eTable< ProgramMapSection > > &ptr)
Definition: pmt.h:159
int getDataDemux(ePtr< iDVBDemux > &demux)
Definition: pmt.cpp:960
void getHBBTVUrl(std::string &ret) const
Definition: pmt.h:164
int getDemuxID() const
Definition: pmt.h:161
~eDVBServicePMTHandler()
Definition: pmt.cpp:54
sigc::signal1< void, int > serviceEvent
Definition: pmt.h:147
void removeCaHandler()
Definition: pmt.cpp:1224
int tune(eServiceReferenceDVB &ref, int use_decode_demux, eCueSheet *sg=0, bool simulate=false, eDVBService *service=0, serviceType type=livetv, bool descramble=true)
Definition: pmt.cpp:1036
eDVBServicePMTHandler()
Definition: pmt.cpp:37
void getAITApplications(std::map< int, std::string > &aitlist)
Definition: pmt.cpp:496
void getCaIds(std::vector< int > &caids, std::vector< int > &ecmpids, std::vector< std::string > &ecmdatabytes)
Definition: pmt.cpp:504
int getServiceReference(eServiceReferenceDVB &service)
Definition: pmt.h:157
void addCaHandler()
Definition: pmt.cpp:1210
PyObject * getHbbTVApplications()
Definition: pmt.cpp:519
void resetCachedProgram()
Definition: pmt.h:162
int getService(ePtr< eDVBService > &service)
Definition: pmt.h:158
Definition: rtspstreamserver.h:17
eDVBChannel * m_channel
Definition: rtspstreamserver.h:70
Definition: idvb.h:192
Definition: esection.h:41
Definition: idvb.h:637
name
Definition: newplugin.py:9
list ref
Definition: create_picon_e1_to_e2.py:17
std::list< HbbTVApplicationInfo * > HbbTVApplicationInfoList
Definition: pmt.h:61
HbbTVApplicationInfoList::const_iterator HbbTVApplicationInfoListConstIterator
Definition: pmt.h:63
HbbTVApplicationInfoList::iterator HbbTVApplicationInfoListIterator
Definition: pmt.h:62
Definition: pmtparse.h:71
Definition: dvb/scan.h:16