Example #1
0
 /// <summary>
 /// Adds the sub channel.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="channel">The channel</param>
 public void AddSubChannel(int id, IChannel channel)
 {
     if (!_mapSubChannels.ContainsKey(id))
     {
         _mapSubChannels[id] = new ConditionalAccessContext();
         if (channel is DVBBaseChannel)
         {
             _mapSubChannels[id].Channel = (DVBBaseChannel)channel;
         }
     }
 }
Example #2
0
        /// <summary>
        /// Sends the PMT to the CI module
        /// </summary>
        /// <param name="subChannel">The sub channel.</param>
        /// <param name="channel">channel on which we are tuned</param>
        /// <param name="PMT">byte array containing the PMT</param>
        /// <param name="pmtLength">length of the pmt array</param>
        /// <param name="audioPid">pid of the current audio stream</param>
        /// <returns></returns>
        public bool SendPMT(int subChannel, DVBBaseChannel channel, byte[] PMT, int pmtLength, int audioPid)
        {
            try
            {
                if (!_useCam)
                {
                    return(true);
                }
                if (channel.FreeToAir)
                {
                    return(true); //no need to descramble this one...
                }
                AddSubChannel(subChannel, channel);
                ConditionalAccessContext context = _mapSubChannels[subChannel];
                context.CamType = _CamType;
                context.Channel = channel;
                if (_CamType == CamType.Astoncrypt2)
                {
                    int newLength;
                    context.PMT       = PatchPMT_AstonCrypt2(PMT, pmtLength, out newLength);
                    context.PMTLength = newLength;
                }
                else
                {
                    context.PMT       = PMT;
                    context.PMTLength = pmtLength;
                }
                context.AudioPid  = audioPid;
                context.ServiceId = channel.ServiceId;

                if (_winTvCiModule != null)
                {
                    int hr = _winTvCiModule.SendPMT(PMT, pmtLength);
                    if (hr != 0)
                    {
                        Log.Log.Info("Conditional Access:  sendPMT to WinTVCI failed");
                        return(false);
                    }
                    Log.Log.Info("Conditional Access:  sendPMT to WinTVCI succeeded");
                    return(true);
                }
                if (_knc != null)
                {
                    ChannelInfo info = new ChannelInfo();
                    info.DecodePmt(PMT);
                    int    caPmtLen;
                    byte[] caPmt = info.caPMT.CaPmtStruct(out caPmtLen);
                    return(_knc.SendPMT(caPmt, caPmtLen));
                }
                if (_DigitalDevices != null)
                {
                    return(_DigitalDevices.SendServiceIdToCam(channel.ServiceId));
                }
                if (_digitalEveryWhere != null)
                {
                    return(_digitalEveryWhere.SendPMTToFireDTV(_mapSubChannels));
                }
                if (_technoTrend != null)
                {
                    return(_technoTrend.DescrambleMultiple(_mapSubChannels));
                    // return _technoTrend.SendPMT(PMT, pmtLength);
                }
                if (_twinhan != null)
                {
                    ChannelInfo info = new ChannelInfo();
                    info.DecodePmt(PMT);

                    int    caPmtLen;
                    byte[] caPmt = info.caPMT.CaPmtStruct(out caPmtLen);
                    return(_twinhan.SendPMT(caPmt, caPmtLen));
                }
            }
            catch (Exception ex)
            {
                Log.Log.Write(ex);
            }
            return(true);
        }
 /// <summary>
 /// Adds the sub channel.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="channel">The channel</param>
 public void AddSubChannel(int id, IChannel channel)
 {
   if (!_mapSubChannels.ContainsKey(id))
   {
     _mapSubChannels[id] = new ConditionalAccessContext();
     if (channel is DVBBaseChannel)
     {
       _mapSubChannels[id].Channel = (DVBBaseChannel)channel;
     }
   }
 }