add a blinking point to the infobar
[enigma2.git] / lib / dvb / pmt.h
index b917383..a23abf1 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __lib_dvb_dvbmid_h
 #define __lib_dvb_dvbmid_h
 
+#include <map>
 #include <lib/dvb/idvb.h>
 #include <lib/dvb/dvb.h>
 #include <lib/dvb/idemux.h>
 
 class eDVBServicePMTHandler;
 
+typedef std::map<eServiceReferenceDVB, eDVBCAService*> CAServiceMap;
+
 class eDVBCAService: public Object
 {
-       eDVBServicePMTHandler &m_parent;
-       int m_sock, m_clilen;
+       eServiceReferenceDVB m_service;
+       uint8_t m_used_demux[10];
+       unsigned int m_prev_build_hash;
+
+       int m_sock, m_clilen; 
        struct sockaddr_un m_servaddr;
        unsigned int m_sendstate;
-       unsigned char *m_capmt;
+       unsigned char m_capmt[2048];
        eTimer m_retryTimer;
        void sendCAPMT();
        void Connect();
+
+       static CAServiceMap exist;
+       eDVBCAService();
+       ~eDVBCAService();
 public:
-       eDVBCAService( eDVBServicePMTHandler &parent )
-               :m_parent(parent), m_sendstate(0), m_capmt(NULL), m_retryTimer(eApp)
-       {
-               CONNECT(m_retryTimer.timeout, eDVBCAService::sendCAPMT);
-               Connect();
-//             eDebug("[eDVBCAHandler] new service %s", service.toString().c_str() );
-       }
-       ~eDVBCAService()
-       {
-               delete [] m_capmt;
-               ::close(m_sock);
-//             eDebug("[eDVBCAHandler] leave service %s", me.toString().c_str() );
-       }
-       void buildCAPMT();
+       static RESULT register_service( const eServiceReferenceDVB &ref, int demux_num, eDVBCAService *&caservice );
+       static RESULT unregister_service( const eServiceReferenceDVB &ref, int demux_num, eTable<ProgramMapSection> *ptr );
+       void buildCAPMT(eTable<ProgramMapSection> *ptr);
 };
 
 class eDVBServicePMTHandler: public Object
@@ -50,7 +49,6 @@ class eDVBServicePMTHandler: public Object
        ePtr<eDVBService> m_service;
 
        int m_last_channel_state;
-       uint16_t m_pmt_pid;
        eDVBCAService *m_ca_servicePtr;
 
        eAUTable<eTable<ProgramMapSection> > m_PMT;
@@ -75,6 +73,7 @@ public:
        enum
        {
                eventNoResources,  // a requested resource couldn't be allocated
+               eventTuneFailed,   // tune failed
                eventNoPAT,        // no pat could be received (timeout)
                eventNoPATEntry,   // no pat entry for the corresponding SID could be found
                eventNoPMT,        // no pmt could be received (timeout)
@@ -109,8 +108,11 @@ public:
        int getProgramInfo(struct program &program);
        int getDemux(ePtr<iDVBDemux> &demux);
        int getPVRChannel(ePtr<iDVBPVRChannel> &pvr_channel);
-       
-       int tune(eServiceReferenceDVB &ref);    
+       int getService(eServiceReferenceDVB &service) { service = m_reference; return 0; }
+       int getPMT(ePtr<eTable<ProgramMapSection> > &ptr) { return m_PMT.getCurrent(ptr); }
+       int getChannel(eUsePtr<iDVBChannel> &channel);
+
+       int tune(eServiceReferenceDVB &ref);
 };
 
 #endif