if (it != m_pmt_handlers.end())
{
eDVBCISlot *slot = it->cislot;
+ eDVBCISlot *base_slot = slot;
eDVBServicePMTHandler *pmthandler = it->pmthandler;
m_pmt_handlers.erase(it);
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<uint16_t> 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<uint16_t> 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)
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)
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;
}
uint16_t program_number = ref.getServiceID().get();
std::map<uint16_t, uint8_t>::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;
capmt.append(*i++);
}
capmt.writeToBuffer(raw_data);
-#if 1
+
// begin calc capmt length
int wp=0;
int hlen;
hlen = 4;
}
// end calc capmt length
-// eDebug("ca_manager %p dump capmt:", ca_manager);
-// for(int i=0;i<wp;i++)
-// eDebugNoNewLine("%02x ", raw_data[i]);
-// eDebug("");
-#endif
- if (caids.size() == 1 && caids[0] == 0xFFFF)
+
+ if (sendEmpty)
{
// eDebugNoNewLine("SEND EMPTY CAPMT.. old version is %02x", raw_data[hlen+3]);
+ if (sendEmpty && running_services.size() == 1) // check if this is the capmt for the last running service
+ raw_data[hlen] = 0x03; // send only instead of update... because of strange effects with alphacrypt
raw_data[hlen+3] &= ~0x3E;
raw_data[hlen+3] |= ((pmt_version+1) & 0x1F) << 1;
// eDebug(" new version is %02x", raw_data[hlen+3]);
}
+// eDebug("ca_manager %p dump capmt:", ca_manager);
+// for(int i=0;i<wp;i++)
+// eDebugNoNewLine("%02x ", raw_data[i]);
+// eDebug("");
+
//dont need tag and lenfield
ca_manager->sendCAPMT(raw_data + hlen, wp - hlen);
running_services[program_number] = pmt_version;