make epixmap load images relative to enigma2 DATADIR
[enigma2.git] / lib / dvb / pmt.h
index 03df198bccf52438fe0e406ebac5d490d4541a89..e260ddd2b94d87394d8cb2ee43f04665bc3eb160 100644 (file)
@@ -3,22 +3,61 @@
 
 #include <lib/dvb/idvb.h>
 #include <lib/dvb/dvb.h>
-#include <lib/dvb/isection.h>
+#include <lib/dvb/idemux.h>
 #include <lib/dvb/esection.h>
-#include <lib/dvb_si/pmt.h>
-#include <lib/dvb_si/pat.h>
+#include <dvbsi++/program_map_section.h>
+#include <dvbsi++/program_association_section.h>
+
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+class eDVBServicePMTHandler;
+
+class eDVBCAService: public Object
+{
+       eDVBServicePMTHandler &m_parent;
+       int m_sock, m_clilen;
+       struct sockaddr_un m_servaddr;
+       unsigned int m_sendstate;
+       unsigned char *m_capmt;
+       eTimer m_retryTimer;
+       void sendCAPMT();
+       void Connect();
+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();
+};
 
 class eDVBServicePMTHandler: public Object
 {
+       friend class eDVBCAService;
        eServiceReferenceDVB m_reference;
-//     ePtr<eDVBService> m_service;
+       ePtr<eDVBService> m_service;
 
        int m_last_channel_state;
-       
-       eAUTable<eTable<ProgramMapTable> > m_PMT;
-       eAUTable<eTable<ProgramAssociationTable> > m_PAT;
+       uint16_t m_pmt_pid;
+       eDVBCAService *m_ca_servicePtr;
+
+       eAUTable<eTable<ProgramMapSection> > m_PMT;
+       eAUTable<eTable<ProgramAssociationSection> > m_PAT;
 
-       ePtr<iDVBChannel> m_channel;
+       eUsePtr<iDVBChannel> m_channel;
+       eUsePtr<iDVBPVRChannel> m_pvr_channel;
        ePtr<eDVBResourceManager> m_resourceManager;
        ePtr<iDVBDemux> m_demux;
        
@@ -29,6 +68,7 @@ class eDVBServicePMTHandler: public Object
        void PATready(int error);
 public:
        eDVBServicePMTHandler();
+       ~eDVBServicePMTHandler();
        
        enum
        {
@@ -65,6 +105,7 @@ public:
        
        int getProgramInfo(struct program &program);
        int getDemux(ePtr<iDVBDemux> &demux);
+       int getPVRChannel(ePtr<iDVBPVRChannel> &pvr_channel);
        
        int tune(eServiceReferenceDVB &ref);    
 };