Advertisement
svenhoefer

Untitled

Feb 12th, 2020
801
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 9.18 KB | None | 0 0
  1. diff --git a/src/zapit/src/capmt.cpp b/src/zapit/src/capmt.cpp
  2. index 8d4351a..d56e68a 100644
  3. --- a/src/zapit/src/capmt.cpp
  4. +++ b/src/zapit/src/capmt.cpp
  5. @@ -240,7 +240,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
  6.     //INFO("channel %llx [%s] mode %d %s update %d", channel_id, channel->getName().c_str(), mode, start ? "START" : "STOP", force_update);
  7.  
  8.     /* FIXME until proper demux management */
  9. -#if ! HAVE_COOL_HARDWARE
  10. +#if ! HAVE_COOL_HARDWARE && ! HAVE_GENERIC_HARDWARE
  11.     CFrontend *frontend = CFEManager::getInstance()->getFrontend(channel);
  12.  #endif
  13.     switch(mode) {
  14. @@ -296,7 +296,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
  15.         cam->sendMessage(NULL, 0, false);
  16.         /* clean up channel_map with stopped record/stream/pip services NOT live-tv */
  17.         it = channel_map.find(channel_id);
  18. -       if(it != channel_map.end() && newmask != 0 && it->second != cam)
  19. +       if(it != channel_map.end() && newmask != 0)
  20.         {
  21.             delete it->second;
  22.             channel_map.erase(channel_id);
  23. @@ -311,14 +311,35 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
  24.             INFO("\033[33m socket only\033[0m");
  25.             cam->makeCaPmt(channel, true);
  26.             cam->setCaPmt(true);
  27. +           // CI
  28. +           CaIdVector caids;
  29. +           cCA::GetInstance()->GetCAIDS(caids);
  30. +           uint8_t list = CCam::CAPMT_ONLY;
  31. +           cam->makeCaPmt(channel, false, list, caids);
  32. +           int len;
  33. +           unsigned char * buffer = channel->getRawPmt(len);
  34. +#if HAVE_COOL_HARDWARE
  35. +           cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI);
  36. +#else
  37. +           cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI, channel->scrambled, channel->camap, mode, start);
  38. +#endif
  39.         }
  40.     }
  41. +
  42.  #if ! HAVE_COOL_HARDWARE
  43.     // CI
  44.     if(oldmask == newmask) {
  45.         INFO("\033[33m (oldmask == newmask)\033[0m");
  46.         if (mode) {
  47. -           if(!start) {
  48. +           if(start) {
  49. +               CaIdVector caids;
  50. +               cCA::GetInstance()->GetCAIDS(caids);
  51. +               uint8_t list = CCam::CAPMT_ONLY;
  52. +               cam->makeCaPmt(channel, false, list, caids);
  53. +               int len;
  54. +               unsigned char * buffer = channel->getRawPmt(len);
  55. +               cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI, channel->scrambled, channel->camap, mode, start);
  56. +           } else {
  57.                 cam->sendCaPmt(channel->getChannelID(), NULL, 0, CA_SLOT_TYPE_CI, channel->scrambled, channel->camap, mode, start);
  58.             }
  59.         }
  60. @@ -329,6 +350,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
  61.         }
  62.     }
  63.  #endif
  64. +
  65.     if(newmask == 0) {
  66.         INFO("\033[33m (newmask == 0)\033[0m");
  67.         /* FIXME: back to live channel from playback dont parse pmt and call setCaPmt
  68. @@ -340,15 +362,13 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
  69.         // hack for rezaping to the recording channel
  70.         CZapitChannel * chan = CServiceManager::getInstance()->GetCurrentChannel();
  71.  
  72. -       //if commig from movieplayer, disable hack
  73. +       //if coming from movieplayer, disable hack
  74.         if(!mp && ( (!mode || (mode && !chan->scrambled)) && (!start && rmode)) ){
  75.             INFO("\033[33m HACK: disabling TS\033[0m");
  76.             cCA::GetInstance()->SetTS(CA_DVBCI_TS_INPUT_DISABLED);
  77.         }
  78.  #endif
  79.  #else
  80. -       mp = false;
  81. -
  82.         /* don't use StopCam() here: ci-cam needs the real mode stop */
  83.         cam->sendCaPmt(channel->getChannelID(), NULL, 0, CA_SLOT_TYPE_CI, channel->scrambled, channel->camap, mode, start);
  84.         cam->sendMessage(NULL, 0, false);
  85. @@ -357,96 +377,101 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
  86.  #endif
  87.     }
  88.  
  89. -#if ! HAVE_COOL_HARDWARE
  90.     // CI
  91. +#if ! HAVE_COOL_HARDWARE
  92.     if (mode && !start) {
  93. -       INFO("\033[33m (mode && !start) do we really need this?\033[0m");
  94. -   }
  95.  #endif
  96. -
  97. -   CaIdVector caids;
  98. -   cCA::GetInstance()->GetCAIDS(caids);
  99. -   //uint8_t list = CCam::CAPMT_FIRST;
  100. -   uint8_t list = CCam::CAPMT_ONLY;
  101. -   if (channel_map.size() > 1)
  102. -       list = CCam::CAPMT_ADD;
  103. +       CaIdVector caids;
  104. +       cCA::GetInstance()->GetCAIDS(caids);
  105. +       //uint8_t list = CCam::CAPMT_FIRST;
  106. +       uint8_t list = CCam::CAPMT_ONLY;
  107. +       if (channel_map.size() > 1)
  108. +           list = CCam::CAPMT_ADD;
  109.  
  110.  #ifdef BOXMODEL_CS_HD2
  111. -   int ci_use_count = 0;
  112. -   for (it = channel_map.begin(); it != channel_map.end(); ++it)
  113. -   {
  114. -       cam = it->second;
  115. -       channel = CServiceManager::getInstance()->FindChannel(it->first);
  116. +       int ci_use_count = 0;
  117. +       for (it = channel_map.begin(); it != channel_map.end(); ++it)
  118. +       {
  119. +           cam = it->second;
  120. +           channel = CServiceManager::getInstance()->FindChannel(it->first);
  121.  
  122. -       if (tunerno >= 0 && tunerno == cDemux::GetSource(cam->getSource())) {
  123. -           cCA::GetInstance()->SetTS((CA_DVBCI_TS_INPUT)tunerno);
  124. -           ci_use_count++;
  125. -           break;
  126. -       } else if (filter_channels) {
  127. -           if (channel && channel->bUseCI)
  128. +           if (tunerno >= 0 && tunerno == cDemux::GetSource(cam->getSource())) {
  129. +               cCA::GetInstance()->SetTS((CA_DVBCI_TS_INPUT)tunerno);
  130.                 ci_use_count++;
  131. -       } else
  132. -           ci_use_count++;
  133. -   }
  134. -   if (ci_use_count == 0) {
  135. -       INFO("CI: not used, disabling TS");
  136. -       cCA::GetInstance()->SetTS(CA_DVBCI_TS_INPUT_DISABLED);
  137. -   }
  138. +               break;
  139. +           } else if (filter_channels) {
  140. +               if (channel && channel->bUseCI)
  141. +                   ci_use_count++;
  142. +           } else
  143. +               ci_use_count++;
  144. +       }
  145. +       if (ci_use_count == 0) {
  146. +           INFO("CI: not used, disabling TS");
  147. +           cCA::GetInstance()->SetTS(CA_DVBCI_TS_INPUT_DISABLED);
  148. +       }
  149.  #endif
  150.  
  151. -   for (it = channel_map.begin(); it != channel_map.end(); /*++it*/)
  152. -   {
  153. -       cam = it->second;
  154. -       channel = CServiceManager::getInstance()->FindChannel(it->first);
  155. -       ++it;
  156. -       if(!channel)
  157. -           continue;
  158. +       for (it = channel_map.begin(); it != channel_map.end(); /*++it*/)
  159. +       {
  160. +           cam = it->second;
  161. +           channel = CServiceManager::getInstance()->FindChannel(it->first);
  162. +           ++it;
  163. +           if(!channel)
  164. +               continue;
  165. +           if(!channel->scrambled)
  166. +               continue;
  167.  
  168.  #if 0
  169. -       if (it == channel_map.end())
  170. -           list |= CCam::CAPMT_LAST; // FIRST->ONLY or MORE->LAST
  171. +           if (it == channel_map.end())
  172. +               list |= CCam::CAPMT_LAST; // FIRST->ONLY or MORE->LAST
  173.  #endif
  174.  
  175. -       cam->makeCaPmt(channel, false, list, caids);
  176. -       int len;
  177. -       unsigned char * buffer = channel->getRawPmt(len);
  178. +           cam->makeCaPmt(channel, false, list, caids);
  179. +           int len;
  180. +           unsigned char * buffer = channel->getRawPmt(len);
  181.  #if HAVE_COOL_HARDWARE
  182. -       cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_SMARTCARD);
  183. +           cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_SMARTCARD);
  184. +#else
  185. +           cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI, channel->scrambled, channel->camap, 0, true);
  186.  #endif
  187. -       if (tunerno >= 0 && tunerno != cDemux::GetSource(cam->getSource())) {
  188. -           INFO("CI: configured tuner %d do not match %d, skip [%s]", tunerno, cam->getSource(), channel->getName().c_str());
  189. -       } else if (filter_channels && !channel->bUseCI) {
  190. -           INFO("CI: filter enabled, CI not used for [%s]", channel->getName().c_str());
  191. -       } else if(channel->scrambled) {
  192. -           useCI = true;
  193. -           INFO("CI: use CI for [%s]", channel->getName().c_str());
  194. +
  195. +           if (tunerno >= 0 && tunerno != cDemux::GetSource(cam->getSource())) {
  196. +               INFO("CI: configured tuner %d do not match %d, skip [%s]", tunerno, cam->getSource(), channel->getName().c_str());
  197. +           } else if (filter_channels && !channel->bUseCI) {
  198. +               INFO("CI: filter enabled, CI not used for [%s]", channel->getName().c_str());
  199. +           } else if(channel->scrambled) {
  200. +               useCI = true;
  201. +               INFO("CI: use CI for [%s]", channel->getName().c_str());
  202. +           } else
  203. +               INFO("CI: no CI needed for [%s]", channel->getName().c_str());
  204. +           //list = CCam::CAPMT_MORE;
  205. +           if((oldmask != newmask) || force_update || (oldmask == newmask && mode && start))
  206. +           {
  207. +               //temp debug output
  208. +               if((oldmask != newmask) || force_update)
  209. +                   INFO("\033[33m (oldmask != newmask) || force_update)\033[0m");
  210. +               else
  211. +                   INFO("\033[33m (oldmask == newmask && mode && start)\033[0m");
  212. +
  213. +               if(useCI)
  214. +               {
  215.  #if HAVE_COOL_HARDWARE
  216. -           cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI);
  217. +                   cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI);
  218. +#else
  219. +                   cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI, channel->scrambled, channel->camap, 0, true);
  220.  #endif
  221. -       }
  222. -       //list = CCam::CAPMT_MORE;
  223. +               }
  224.  #if ! HAVE_COOL_HARDWARE
  225. -       if((oldmask != newmask) || force_update || (oldmask == newmask && mode && start))
  226. -       {
  227. -           //temp debug output
  228. -           if((oldmask != newmask) || force_update)
  229. -               INFO("\033[33m (oldmask != newmask) || force_update)\033[0m");
  230. -           else
  231. -               INFO("\033[33m (oldmask == newmask && mode && start)\033[0m");
  232. -
  233. -           if(useCI)
  234. -           {
  235. -               cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI, channel->scrambled, channel->camap, 0, true);
  236. -           }
  237. -           else
  238. -           {
  239. -               INFO("\033[33m no CI needed\033[0m");
  240. -               //no CI needed
  241. -               cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI, false /*channel->scrambled*/, channel->camap, mode, start);
  242. +               else
  243. +               {
  244. +                   cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI, false /*channel->scrambled*/, channel->camap, mode, start);
  245. +               }
  246. +#endif
  247.             }
  248.         }
  249. -#endif
  250. +#if ! HAVE_COOL_HARDWARE
  251.     }
  252. +#endif
  253.  
  254.     return true;
  255.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement