Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/zapit/src/capmt.cpp b/src/zapit/src/capmt.cpp
- index 8d4351a..d56e68a 100644
- --- a/src/zapit/src/capmt.cpp
- +++ b/src/zapit/src/capmt.cpp
- @@ -240,7 +240,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
- //INFO("channel %llx [%s] mode %d %s update %d", channel_id, channel->getName().c_str(), mode, start ? "START" : "STOP", force_update);
- /* FIXME until proper demux management */
- -#if ! HAVE_COOL_HARDWARE
- +#if ! HAVE_COOL_HARDWARE && ! HAVE_GENERIC_HARDWARE
- CFrontend *frontend = CFEManager::getInstance()->getFrontend(channel);
- #endif
- switch(mode) {
- @@ -296,7 +296,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
- cam->sendMessage(NULL, 0, false);
- /* clean up channel_map with stopped record/stream/pip services NOT live-tv */
- it = channel_map.find(channel_id);
- - if(it != channel_map.end() && newmask != 0 && it->second != cam)
- + if(it != channel_map.end() && newmask != 0)
- {
- delete it->second;
- channel_map.erase(channel_id);
- @@ -311,14 +311,35 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
- INFO("\033[33m socket only\033[0m");
- cam->makeCaPmt(channel, true);
- cam->setCaPmt(true);
- + // CI
- + CaIdVector caids;
- + cCA::GetInstance()->GetCAIDS(caids);
- + uint8_t list = CCam::CAPMT_ONLY;
- + cam->makeCaPmt(channel, false, list, caids);
- + int len;
- + unsigned char * buffer = channel->getRawPmt(len);
- +#if HAVE_COOL_HARDWARE
- + cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI);
- +#else
- + cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI, channel->scrambled, channel->camap, mode, start);
- +#endif
- }
- }
- +
- #if ! HAVE_COOL_HARDWARE
- // CI
- if(oldmask == newmask) {
- INFO("\033[33m (oldmask == newmask)\033[0m");
- if (mode) {
- - if(!start) {
- + if(start) {
- + CaIdVector caids;
- + cCA::GetInstance()->GetCAIDS(caids);
- + uint8_t list = CCam::CAPMT_ONLY;
- + cam->makeCaPmt(channel, false, list, caids);
- + int len;
- + unsigned char * buffer = channel->getRawPmt(len);
- + cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI, channel->scrambled, channel->camap, mode, start);
- + } else {
- cam->sendCaPmt(channel->getChannelID(), NULL, 0, CA_SLOT_TYPE_CI, channel->scrambled, channel->camap, mode, start);
- }
- }
- @@ -329,6 +350,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
- }
- }
- #endif
- +
- if(newmask == 0) {
- INFO("\033[33m (newmask == 0)\033[0m");
- /* FIXME: back to live channel from playback dont parse pmt and call setCaPmt
- @@ -340,15 +362,13 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
- // hack for rezaping to the recording channel
- CZapitChannel * chan = CServiceManager::getInstance()->GetCurrentChannel();
- - //if commig from movieplayer, disable hack
- + //if coming from movieplayer, disable hack
- if(!mp && ( (!mode || (mode && !chan->scrambled)) && (!start && rmode)) ){
- INFO("\033[33m HACK: disabling TS\033[0m");
- cCA::GetInstance()->SetTS(CA_DVBCI_TS_INPUT_DISABLED);
- }
- #endif
- #else
- - mp = false;
- -
- /* don't use StopCam() here: ci-cam needs the real mode stop */
- cam->sendCaPmt(channel->getChannelID(), NULL, 0, CA_SLOT_TYPE_CI, channel->scrambled, channel->camap, mode, start);
- cam->sendMessage(NULL, 0, false);
- @@ -357,96 +377,101 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
- #endif
- }
- -#if ! HAVE_COOL_HARDWARE
- // CI
- +#if ! HAVE_COOL_HARDWARE
- if (mode && !start) {
- - INFO("\033[33m (mode && !start) do we really need this?\033[0m");
- - }
- #endif
- -
- - CaIdVector caids;
- - cCA::GetInstance()->GetCAIDS(caids);
- - //uint8_t list = CCam::CAPMT_FIRST;
- - uint8_t list = CCam::CAPMT_ONLY;
- - if (channel_map.size() > 1)
- - list = CCam::CAPMT_ADD;
- + CaIdVector caids;
- + cCA::GetInstance()->GetCAIDS(caids);
- + //uint8_t list = CCam::CAPMT_FIRST;
- + uint8_t list = CCam::CAPMT_ONLY;
- + if (channel_map.size() > 1)
- + list = CCam::CAPMT_ADD;
- #ifdef BOXMODEL_CS_HD2
- - int ci_use_count = 0;
- - for (it = channel_map.begin(); it != channel_map.end(); ++it)
- - {
- - cam = it->second;
- - channel = CServiceManager::getInstance()->FindChannel(it->first);
- + int ci_use_count = 0;
- + for (it = channel_map.begin(); it != channel_map.end(); ++it)
- + {
- + cam = it->second;
- + channel = CServiceManager::getInstance()->FindChannel(it->first);
- - if (tunerno >= 0 && tunerno == cDemux::GetSource(cam->getSource())) {
- - cCA::GetInstance()->SetTS((CA_DVBCI_TS_INPUT)tunerno);
- - ci_use_count++;
- - break;
- - } else if (filter_channels) {
- - if (channel && channel->bUseCI)
- + if (tunerno >= 0 && tunerno == cDemux::GetSource(cam->getSource())) {
- + cCA::GetInstance()->SetTS((CA_DVBCI_TS_INPUT)tunerno);
- ci_use_count++;
- - } else
- - ci_use_count++;
- - }
- - if (ci_use_count == 0) {
- - INFO("CI: not used, disabling TS");
- - cCA::GetInstance()->SetTS(CA_DVBCI_TS_INPUT_DISABLED);
- - }
- + break;
- + } else if (filter_channels) {
- + if (channel && channel->bUseCI)
- + ci_use_count++;
- + } else
- + ci_use_count++;
- + }
- + if (ci_use_count == 0) {
- + INFO("CI: not used, disabling TS");
- + cCA::GetInstance()->SetTS(CA_DVBCI_TS_INPUT_DISABLED);
- + }
- #endif
- - for (it = channel_map.begin(); it != channel_map.end(); /*++it*/)
- - {
- - cam = it->second;
- - channel = CServiceManager::getInstance()->FindChannel(it->first);
- - ++it;
- - if(!channel)
- - continue;
- + for (it = channel_map.begin(); it != channel_map.end(); /*++it*/)
- + {
- + cam = it->second;
- + channel = CServiceManager::getInstance()->FindChannel(it->first);
- + ++it;
- + if(!channel)
- + continue;
- + if(!channel->scrambled)
- + continue;
- #if 0
- - if (it == channel_map.end())
- - list |= CCam::CAPMT_LAST; // FIRST->ONLY or MORE->LAST
- + if (it == channel_map.end())
- + list |= CCam::CAPMT_LAST; // FIRST->ONLY or MORE->LAST
- #endif
- - cam->makeCaPmt(channel, false, list, caids);
- - int len;
- - unsigned char * buffer = channel->getRawPmt(len);
- + cam->makeCaPmt(channel, false, list, caids);
- + int len;
- + unsigned char * buffer = channel->getRawPmt(len);
- #if HAVE_COOL_HARDWARE
- - cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_SMARTCARD);
- + cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_SMARTCARD);
- +#else
- + cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI, channel->scrambled, channel->camap, 0, true);
- #endif
- - if (tunerno >= 0 && tunerno != cDemux::GetSource(cam->getSource())) {
- - INFO("CI: configured tuner %d do not match %d, skip [%s]", tunerno, cam->getSource(), channel->getName().c_str());
- - } else if (filter_channels && !channel->bUseCI) {
- - INFO("CI: filter enabled, CI not used for [%s]", channel->getName().c_str());
- - } else if(channel->scrambled) {
- - useCI = true;
- - INFO("CI: use CI for [%s]", channel->getName().c_str());
- +
- + if (tunerno >= 0 && tunerno != cDemux::GetSource(cam->getSource())) {
- + INFO("CI: configured tuner %d do not match %d, skip [%s]", tunerno, cam->getSource(), channel->getName().c_str());
- + } else if (filter_channels && !channel->bUseCI) {
- + INFO("CI: filter enabled, CI not used for [%s]", channel->getName().c_str());
- + } else if(channel->scrambled) {
- + useCI = true;
- + INFO("CI: use CI for [%s]", channel->getName().c_str());
- + } else
- + INFO("CI: no CI needed for [%s]", channel->getName().c_str());
- + //list = CCam::CAPMT_MORE;
- + if((oldmask != newmask) || force_update || (oldmask == newmask && mode && start))
- + {
- + //temp debug output
- + if((oldmask != newmask) || force_update)
- + INFO("\033[33m (oldmask != newmask) || force_update)\033[0m");
- + else
- + INFO("\033[33m (oldmask == newmask && mode && start)\033[0m");
- +
- + if(useCI)
- + {
- #if HAVE_COOL_HARDWARE
- - cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI);
- + cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI);
- +#else
- + cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI, channel->scrambled, channel->camap, 0, true);
- #endif
- - }
- - //list = CCam::CAPMT_MORE;
- + }
- #if ! HAVE_COOL_HARDWARE
- - if((oldmask != newmask) || force_update || (oldmask == newmask && mode && start))
- - {
- - //temp debug output
- - if((oldmask != newmask) || force_update)
- - INFO("\033[33m (oldmask != newmask) || force_update)\033[0m");
- - else
- - INFO("\033[33m (oldmask == newmask && mode && start)\033[0m");
- -
- - if(useCI)
- - {
- - cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI, channel->scrambled, channel->camap, 0, true);
- - }
- - else
- - {
- - INFO("\033[33m no CI needed\033[0m");
- - //no CI needed
- - cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI, false /*channel->scrambled*/, channel->camap, mode, start);
- + else
- + {
- + cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI, false /*channel->scrambled*/, channel->camap, mode, start);
- + }
- +#endif
- }
- }
- -#endif
- +#if ! HAVE_COOL_HARDWARE
- }
- +#endif
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement