1 #ifndef __lib_dvb_dvbmid_h
2 #define __lib_dvb_dvbmid_h
5 #include <lib/dvb/idvb.h>
6 #include <lib/dvb/dvb.h>
7 #include <lib/dvb/idemux.h>
8 #include <lib/dvb/esection.h>
9 #include <dvbsi++/program_map_section.h>
10 #include <dvbsi++/program_association_section.h>
12 #include <sys/socket.h>
13 #include <sys/types.h>
20 typedef std::map<eServiceReferenceDVB, eDVBCAService*> CAServiceMap;
22 class eDVBCAService: public Object
24 eServiceReferenceDVB m_service;
25 uint8_t m_used_demux[32];
26 unsigned int m_prev_build_hash;
29 struct sockaddr_un m_servaddr;
30 unsigned int m_sendstate;
31 unsigned char m_capmt[2048];
36 static CAServiceMap exist;
40 static RESULT register_service( const eServiceReferenceDVB &ref, int demux_nums[2], eDVBCAService *&caservice );
41 static RESULT unregister_service( const eServiceReferenceDVB &ref, int demux_nums[2], eTable<ProgramMapSection> *ptr );
42 void buildCAPMT(eTable<ProgramMapSection> *ptr);
45 class eDVBServicePMTHandler: public Object
47 friend class eDVBCAService;
48 eServiceReferenceDVB m_reference;
49 ePtr<eDVBService> m_service;
51 int m_last_channel_state;
52 eDVBCAService *m_ca_servicePtr;
54 eAUTable<eTable<ProgramMapSection> > m_PMT;
55 eAUTable<eTable<ProgramAssociationSection> > m_PAT;
57 eUsePtr<iDVBChannel> m_channel;
58 eUsePtr<iDVBPVRChannel> m_pvr_channel;
59 ePtr<eDVBResourceManager> m_resourceManager;
60 ePtr<iDVBDemux> m_demux;
62 void channelStateChanged(iDVBChannel *);
63 ePtr<eConnection> m_channelStateChanged_connection;
64 void channelEvent(iDVBChannel *, int event);
65 ePtr<eConnection> m_channelEvent_connection;
67 void PMTready(int error);
68 void PATready(int error);
70 int m_use_decode_demux;
71 uint8_t m_decode_demux_num;
74 eDVBServicePMTHandler();
75 ~eDVBServicePMTHandler();
79 eventNoResources, // a requested resource couldn't be allocated
80 eventTuneFailed, // tune failed
81 eventNoPAT, // no pat could be received (timeout)
82 eventNoPATEntry, // no pat entry for the corresponding SID could be found
83 eventNoPMT, // no pmt could be received (timeout)
84 eventNewProgramInfo, // we just received a PMT
85 eventTuned, // a channel was sucessfully (re-)tuned in, you may start additional filters now
87 eventSOF, // seek pre start
88 eventEOF, // a file playback did end
91 Signal1<void,int> serviceEvent;
102 enum { atMPEG, atAC3, atDTS };
103 int type; // mpeg2, ac3, dts, ...
106 std::string language_code; /* iso-639, if available. */
111 std::vector<videoStream> videoStreams;
112 std::vector<audioStream> audioStreams;
120 int getProgramInfo(struct program &program);
121 int getDataDemux(ePtr<iDVBDemux> &demux);
122 int getDecodeDemux(ePtr<iDVBDemux> &demux);
124 int getPVRChannel(ePtr<iDVBPVRChannel> &pvr_channel);
125 int getService(eServiceReferenceDVB &service) { service = m_reference; return 0; }
126 int getPMT(ePtr<eTable<ProgramMapSection> > &ptr) { return m_PMT.getCurrent(ptr); }
127 int getChannel(eUsePtr<iDVBChannel> &channel);
129 int tune(eServiceReferenceDVB &ref, int use_decode_demux, eCueSheet *sg=0);