示例#1
0
void CPmt::MakeCAMap(casys_map_t &camap)
{
	ProgramMapSection pmt(buffer);
	CaProgramMapSection capmt(&pmt, 0x03, 0x01);
	DescriptorConstIterator dit;
	for (dit = capmt.getDescriptors()->begin(); dit != capmt.getDescriptors()->end(); ++dit) {
		if ((*dit)->getTag() == CA_DESCRIPTOR ) {
			CaDescriptor * d = (CaDescriptor*) *dit;
			//printf("%02X: casys %04X capid %04X, ", d->getTag(), d->getCaSystemId(), d->getCaPid());
			camap.insert(d->getCaSystemId());
		}
	}
	const ElementaryStreamInfoList * eslist = pmt.getEsInfo();
	ElementaryStreamInfoConstIterator it;
	for (it = eslist->begin(); it != eslist->end(); ++it) {
		ElementaryStreamInfo *esinfo = *it;
		const DescriptorList * dlist = esinfo->getDescriptors();
		for (dit = dlist->begin(); dit != dlist->end(); ++dit) {
			if ((*dit)->getTag() == CA_DESCRIPTOR ) {
				CaDescriptor * d = (CaDescriptor*) *dit;
				camap.insert(d->getCaSystemId());
			}
		}
	}
}
示例#2
0
bool CCam::makeCaPmt(CZapitChannel * channel, bool add_private, uint8_t list, const CaIdVector &caids)
{
        int len;
        unsigned char * buffer = channel->getRawPmt(len);

	INFO("cam %x source %d camask %d list %02x buffer", (int) this, source_demux, camask, list);

	if(!buffer)
		return false;

	ProgramMapSection pmt(buffer);
	CaProgramMapSection capmt(&pmt, list, 0x01, caids);

	if (add_private) {
		uint8_t tmp[10];
		tmp[0] = 0x84;
		tmp[1] = 0x02;
		tmp[2] = channel->getPmtPid() >> 8;
		tmp[3] = channel->getPmtPid() & 0xFF;
		capmt.injectDescriptor(tmp, false);

		tmp[0] = 0x82;
		tmp[1] = 0x02;
		tmp[2] = camask;
		tmp[3] = source_demux;
		capmt.injectDescriptor(tmp, false);

		memset(tmp, 0, sizeof(tmp));
		tmp[0] = 0x81;
		tmp[1] = 0x08;
		tmp[2] = channel->getSatellitePosition() >> 8;
		tmp[3] = channel->getSatellitePosition() & 0xFF;
		tmp[4] = channel->getFreqId() >> 8;
		tmp[5] = channel->getFreqId() & 0xFF;
		tmp[6] = channel->getTransportStreamId() >> 8;
		tmp[7] = channel->getTransportStreamId() & 0xFF;
		tmp[8] = channel->getOriginalNetworkId() >> 8;
		tmp[9] = channel->getOriginalNetworkId() & 0xFF;

		capmt.injectDescriptor(tmp, false);
	}

	calen = capmt.writeToBuffer(cabuf);
#ifdef DEBUG_CAPMT
	printf("CAPMT: ");
	for(int i = 0; i < calen; i++)
		printf("%02X ", cabuf[i]);
	printf("\n");
#endif
	return true;
}