fix restart of playback after EOF (fixes bug #241)
[enigma2.git] / lib / dvb_ci / dvbci_camgr.cpp
index b765146..42317b3 100644 (file)
@@ -1,40 +1,43 @@
 /* DVB CI CA Manager */
 
+#include <lib/base/eerror.h>
 #include <lib/dvb_ci/dvbci_camgr.h>
 
 eDVBCICAManagerSession::eDVBCICAManagerSession(eDVBCISlot *tslot)
 {
        slot = tslot;
-       slot->ca_manager = this;
+       slot->setCAManager(this);
 }
 
 eDVBCICAManagerSession::~eDVBCICAManagerSession()
 {
-       slot->ca_manager = 0;
+       slot->setCAManager(NULL);
 }
 
 int eDVBCICAManagerSession::receivedAPDU(const unsigned char *tag, const void *data, int len)
 {
-       printf("SESSION(%d)/CA %02x %02x %02x: ", session_nb, tag[0], tag[1],tag[2]);
+       eDebugNoNewLine("SESSION(%d)/CA %02x %02x %02x: ", session_nb, tag[0], tag[1],tag[2]);
        for (int i=0; i<len; i++)
-               printf("%02x ", ((const unsigned char*)data)[i]);
-       printf("\n");
+               eDebugNoNewLine("%02x ", ((const unsigned char*)data)[i]);
+       eDebug("");
 
        if ((tag[0]==0x9f) && (tag[1]==0x80))
        {
                switch (tag[2])
                {
                case 0x31:
-                       printf("ca info:\n");
+                       eDebug("ca info:");
                        for (int i=0; i<len; i+=2)
                        {
-                               printf("%04x ", (((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
+                               eDebugNoNewLine("%04x ", (((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
                                caids.push_back((((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
                        }
-                       printf("\n");
+                       std::sort(caids.begin(), caids.end());
+                       eDebug("");
+                       eDVBCIInterfaces::getInstance()->recheckPMTHandlers();
                        break;
                default:
-                       printf("unknown APDU tag 9F 80 %02x\n", tag[2]);
+                       eDebug("unknown APDU tag 9F 80 %02x", tag[2]);
                        break;
                }
        }
@@ -53,7 +56,7 @@ int eDVBCICAManagerSession::doAction()
                return 0;
        }
        case stateFinal:
-               printf("stateFinal und action! kann doch garnicht sein ;)\n");
+               eDebug("stateFinal und action! kann doch garnicht sein ;)");
        default:
                return 0;
        }
@@ -61,9 +64,10 @@ int eDVBCICAManagerSession::doAction()
 
 int eDVBCICAManagerSession::sendCAPMT(unsigned char *data, int len)
 {
-       int i;
        const unsigned char tag[3]={0x9F, 0x80, 0x32}; // ca_pmt
 
-  sendAPDU(tag, data, len);
+       sendAPDU(tag, data, len);
+
+       return 0;
 }