X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/c8bba1502bb3809d55fade29a0a9566875aa8745..99f2eac17b09061f69ac92bc4d06b2f3e5576e5a:/lib/dvb_ci/dvbci.cpp diff --git a/lib/dvb_ci/dvbci.cpp b/lib/dvb_ci/dvbci.cpp index 0a32b8f2..374672ae 100644 --- a/lib/dvb_ci/dvbci.cpp +++ b/lib/dvb_ci/dvbci.cpp @@ -297,8 +297,9 @@ void eDVBCIInterfaces::recheckPMTHandlers() if (!pmthandler->getProgramInfo(p)) { int cnt=0; - for (caidSet::reverse_iterator x(p.caids.rbegin()); x != p.caids.rend(); ++x, ++cnt) - caids.push_front(*x); + std::set set(p.caids.begin(), p.caids.end()); + for (std::set::reverse_iterator x(set.rbegin()); x != set.rend(); ++x, ++cnt) + caids.push_front(x->caid); if (service && cnt) service->m_ca = caids; } @@ -552,6 +553,7 @@ void eDVBCIInterfaces::removePMTHandler(eDVBServicePMTHandler *pmthandler) if (it != m_pmt_handlers.end()) { eDVBCISlot *slot = it->cislot; + eDVBCISlot *base_slot = slot; eDVBServicePMTHandler *pmthandler = it->pmthandler; m_pmt_handlers.erase(it); @@ -575,20 +577,17 @@ void eDVBCIInterfaces::removePMTHandler(eDVBServicePMTHandler *pmthandler) while(slot) { + eDVBCISlot *next = slot->linked_next; if (!sameServiceExist) { -// if (slot->getNumOfServices() > 1) - { - eDebug("[eDVBCIInterfaces] remove last pmt handler for service %s send empty capmt", - service_to_remove.toString().c_str()); - std::vector caids; - caids.push_back(0xFFFF); - slot->sendCAPMT(pmthandler, caids); // send a capmt without caids to remove a running service - } + eDebug("[eDVBCIInterfaces] remove last pmt handler for service %s send empty capmt", + service_to_remove.toString().c_str()); + std::vector caids; + caids.push_back(0xFFFF); + slot->sendCAPMT(pmthandler, caids); // send a capmt without caids to remove a running service slot->removeService(service_to_remove.getServiceID().get()); } - eDVBCISlot *next = slot->linked_next; if (!--slot->use_count) { if (slot->linked_next) @@ -596,9 +595,7 @@ void eDVBCIInterfaces::removePMTHandler(eDVBServicePMTHandler *pmthandler) else setInputSource(slot->current_tuner, slot->current_source); - if (it->cislot == slot) // remove the base slot - it->cislot = slot->linked_next; - else + if (base_slot != slot) { eDVBCISlot *tmp = it->cislot; while(tmp->linked_next != slot) @@ -609,6 +606,8 @@ void eDVBCIInterfaces::removePMTHandler(eDVBServicePMTHandler *pmthandler) else tmp->linked_next = 0; } + else // removed old base slot.. update ptr + base_slot = slot->linked_next; slot->linked_next = 0; slot->user_mapped = false; } @@ -740,7 +739,7 @@ PyObject *eDVBCIInterfaces::getDescrambleRules(int slotid) if (!slot) { char tmp[255]; - snprintf(tmp, 255, "eDVBCIInterfaces::getDescrambleRules try to get rules for CI Slot %d... but just %d slots are available", slotid, m_slots.size()); + snprintf(tmp, 255, "eDVBCIInterfaces::getDescrambleRules try to get rules for CI Slot %d... but just %zd slots are available", slotid, m_slots.size()); PyErr_SetString(PyExc_StandardError, tmp); return 0; } @@ -792,7 +791,7 @@ RESULT eDVBCIInterfaces::setDescrambleRules(int slotid, SWIG_PYOBJECT(ePyObject) if (!slot) { char tmp[255]; - snprintf(tmp, 255, "eDVBCIInterfaces::setDescrambleRules try to set rules for CI Slot %d... but just %d slots are available", slotid, m_slots.size()); + snprintf(tmp, 255, "eDVBCIInterfaces::setDescrambleRules try to set rules for CI Slot %d... but just %zd slots are available", slotid, m_slots.size()); PyErr_SetString(PyExc_StandardError, tmp); return -1; } @@ -863,7 +862,7 @@ RESULT eDVBCIInterfaces::setDescrambleRules(int slotid, SWIG_PYOBJECT(ePyObject) if (PyTuple_Size(tuple) != 2) { char buf[255]; - snprintf(buf, 255, "eDVBCIInterfaces::setDescrambleRules provider tuple has %d instead of 2 entries!!", PyTuple_Size(tuple)); + snprintf(buf, 255, "eDVBCIInterfaces::setDescrambleRules provider tuple has %zd instead of 2 entries!!", PyTuple_Size(tuple)); PyErr_SetString(PyExc_StandardError, buf); return -1; } @@ -915,7 +914,7 @@ PyObject *eDVBCIInterfaces::readCICaIds(int slotid) if (!slot) { char tmp[255]; - snprintf(tmp, 255, "eDVBCIInterfaces::readCICaIds try to get CAIds for CI Slot %d... but just %d slots are available", slotid, m_slots.size()); + snprintf(tmp, 255, "eDVBCIInterfaces::readCICaIds try to get CAIds for CI Slot %d... but just %zd slots are available", slotid, m_slots.size()); PyErr_SetString(PyExc_StandardError, tmp); } else @@ -1190,10 +1189,11 @@ int eDVBCISlot::sendCAPMT(eDVBServicePMTHandler *pmthandler, const std::vector::iterator it = running_services.find(program_number); + bool sendEmpty = caids.size() == 1 && caids[0] == 0xFFFF; if ( it != running_services.end() && (pmt_version == it->second) && - !(caids.size() == 1 && caids[0] == 0xFFFF) ) + !sendEmpty ) { eDebug("[eDVBCISlot] dont send self capmt version twice"); return -1; @@ -1218,7 +1218,7 @@ int eDVBCISlot::sendCAPMT(eDVBServicePMTHandler *pmthandler, const std::vectorsendCAPMT(raw_data + hlen, wp - hlen); running_services[program_number] = pmt_version;