From d3961719cdbf6bc4c4944a4321eaa28a8f0b7fd6 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 29 Oct 2012 19:00:49 +0400 Subject: [PATCH] zapit/src/capmt.cpp: dont send private descriptors; change ca list mode to ONLY/single channel and ADD, if there are more Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/3a0750c5d77756dd1ff13abf0e05668a757c3616 Author: [CST] Focus Date: 2012-10-29 (Mon, 29 Oct 2012) --- src/zapit/include/zapit/capmt.h | 2 +- src/zapit/src/capmt.cpp | 67 ++++++++++++++++++--------------- 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/src/zapit/include/zapit/capmt.h b/src/zapit/include/zapit/capmt.h index c24267c58..674429940 100644 --- a/src/zapit/include/zapit/capmt.h +++ b/src/zapit/include/zapit/capmt.h @@ -65,7 +65,7 @@ class CCam : public CBasicClient CCam(); virtual ~CCam() {}; bool sendMessage(const char * const data, const size_t length, bool update = false); - bool makeCaPmt(CZapitChannel * channel, uint8_t list = CAPMT_ONLY, const CaIdVector &caids = CaIdVector()); + bool makeCaPmt(CZapitChannel * channel, bool add_private, uint8_t list = CAPMT_ONLY, const CaIdVector &caids = CaIdVector()); bool setCaPmt(bool update = false); bool sendCaPmt(uint64_t tpid, uint8_t *rawpmt, int rawlen); int makeMask(int demux, bool add); diff --git a/src/zapit/src/capmt.cpp b/src/zapit/src/capmt.cpp index 47a680e65..b600a2f99 100644 --- a/src/zapit/src/capmt.cpp +++ b/src/zapit/src/capmt.cpp @@ -32,7 +32,7 @@ #include #include -//#define DEBUG_CAPMT +#define DEBUG_CAPMT CCam::CCam() { @@ -76,12 +76,12 @@ bool CCam::sendMessage(const char * const data, const size_t length, bool update return send_data(data, length); } -bool CCam::makeCaPmt(CZapitChannel * channel, uint8_t list, const CaIdVector &caids) +bool CCam::makeCaPmt(CZapitChannel * channel, bool add_private, uint8_t list, const CaIdVector &caids) { int len; unsigned char * buffer = channel->getRawPmt(len); - DBG("cam %x source %d camask %d list %02x buffer", (int) this, source_demux, camask, list); + INFO("cam %x source %d camask %d list %02x buffer", (int) this, source_demux, camask, list); if(!buffer) return false; @@ -89,32 +89,34 @@ bool CCam::makeCaPmt(CZapitChannel * channel, uint8_t list, const CaIdVector &ca ProgramMapSection pmt(buffer); CaProgramMapSection capmt(&pmt, list, 0x01, caids); - uint8_t tmp[10]; - tmp[0] = 0x84; - tmp[1] = 0x02; - tmp[2] = channel->getPmtPid() >> 8; - tmp[3] = channel->getPmtPid() & 0xFF; - capmt.injectDescriptor(tmp, false); + 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); + 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; + 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); + capmt.injectDescriptor(tmp, false); + } calen = capmt.writeToBuffer(cabuf); #ifdef DEBUG_CAPMT @@ -235,7 +237,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start if(newmask == 0) { cam->sendMessage(NULL, 0, false); } else { - cam->makeCaPmt(channel); + cam->makeCaPmt(channel, true); cam->setCaPmt(true); } } @@ -249,7 +251,10 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start } CaIdVector caids; cCA::GetInstance()->GetCAIDS(caids); - uint8_t list = CCam::CAPMT_FIRST; + //uint8_t list = CCam::CAPMT_FIRST; + uint8_t list = CCam::CAPMT_ONLY; + if (channel_map.size() > 1) + list = CCam::CAPMT_ADD; for (it = channel_map.begin(); it != channel_map.end(); /*++it*/) { cam = it->second; @@ -258,14 +263,16 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start if(!channel) continue; +#if 0 if (it == channel_map.end()) list |= CCam::CAPMT_LAST; // FIRST->ONLY or MORE->LAST +#endif - cam->makeCaPmt(channel, list, caids); + cam->makeCaPmt(channel, false, list, caids); int len; unsigned char * buffer = channel->getRawPmt(len); cam->sendCaPmt(channel->getTransponderId(), buffer, len); - list = CCam::CAPMT_MORE; + //list = CCam::CAPMT_MORE; } mutex.unlock();