cCiCaPmt CreateCAPMT(const ProgramMapTable &pmt, const unsigned short *casids, uint cplm) { cCiCaPmt capmt(pmt.ProgramNumber(), cplm); // Add CA descriptors for the service desc_list_t gdesc = MPEGDescriptor::ParseOnlyInclude( pmt.ProgramInfo(), pmt.ProgramInfoLength(), DescriptorID::conditional_access); process_desc(capmt, casids, gdesc); // Add elementary streams + CA descriptors for (uint i = 0; i < pmt.StreamCount(); i++) { LOG(VB_DVBCAM, LOG_INFO, QString("DVBCam: Adding elementary stream: %1, pid(0x%2)") .arg(pmt.StreamDescription(i, "dvb")) .arg(pmt.StreamPID(i),0,16)); capmt.AddElementaryStream(pmt.StreamType(i), pmt.StreamPID(i)); desc_list_t desc = MPEGDescriptor::ParseOnlyInclude( pmt.StreamInfo(i), pmt.StreamInfoLength(i), DescriptorID::conditional_access); process_desc(capmt, casids, desc); } return capmt; }
/* * Send a CA_PMT object to the CAM (see EN50221, section 8.4.3.4) */ void DVBCam::SendPMT(const ProgramMapTable &pmt, uint cplm) { bool success = false; for (uint s = 0; s < (uint)ciHandler->NumSlots(); s++) { const unsigned short *casids = ciHandler->GetCaSystemIds(s); if (!casids) { LOG(success ? VB_DVBCAM : VB_GENERAL, LOG_ERR, LOC + "GetCaSystemIds returned NULL! " + QString("(Slot #%1)").arg(s)); continue; } if (!casids[0]) { LOG(success ? VB_DVBCAM : VB_GENERAL, LOG_ERR, LOC + "CAM supports no CA systems! " + QString("(Slot #%1)").arg(s)); continue; } LOG(VB_DVBCAM, LOG_INFO, LOC + QString("Creating CA_PMT, ServiceID = %1") .arg(pmt.ProgramNumber())); cCiCaPmt capmt = CreateCAPMT(pmt, casids, cplm); LOG(VB_DVBCAM, LOG_INFO, LOC + QString("Sending CA_PMT with %1 to CI slot #%2") .arg(cplm_info[cplm]).arg(s)); if (!ciHandler->SetCaPmt(capmt, s)) LOG(success ? VB_DVBCAM : VB_GENERAL, LOG_ERR, LOC + "CA_PMT send failed!"); else success = true; } }