/// <summary>
        /// Determines whether the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"></see> to compare with the current <see cref="T:System.Object"></see>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>; otherwise, false.
        /// </returns>
        public override bool Equals(object obj)
        {
            if ((obj as DVBBaseChannel) == null)
            {
                return(false);
            }
            DVBBaseChannel ch = obj as DVBBaseChannel;

            if (ch.FreeToAir != FreeToAir)
            {
                return(false);
            }
            if (ch.Frequency != Frequency)
            {
                return(false);
            }
            if (ch.IsRadio != IsRadio)
            {
                return(false);
            }
            if (ch.IsTv != IsTv)
            {
                return(false);
            }
            if (ch.Name != Name)
            {
                return(false);
            }
            if (ch.NetworkId != NetworkId)
            {
                return(false);
            }
            if (ch.PmtPid != PmtPid)
            {
                return(false);
            }
            if (ch.Provider != Provider)
            {
                return(false);
            }
            if (ch.ServiceId != ServiceId)
            {
                return(false);
            }
            if (ch.TransportId != TransportId)
            {
                return(false);
            }
            if (ch.LogicalChannelNumber != LogicalChannelNumber)
            {
                return(false);
            }
            return(true);
        }
 /// <summary>
 /// ctor
 /// </summary>
 public DVBBaseChannel(DVBBaseChannel chan)
 {
     _channelName      = chan._channelName;
     _providerName     = chan._providerName;
     _channelFrequency = chan._channelFrequency;
     _networkId        = chan._networkId;
     _serviceId        = chan._serviceId;
     _transportId      = chan._transportId;
     _pmtPid           = chan._pmtPid;
     _lcn       = chan._lcn;
     _isRadio   = chan._isRadio;
     _isTv      = chan._isTv;
     _freeToAir = chan._freeToAir;
 }
 /// <summary>
 /// ctor
 /// </summary>
 public DVBBaseChannel(DVBBaseChannel chan)
 {
   _channelName = chan._channelName;
   _providerName = chan._providerName;
   _channelFrequency = chan._channelFrequency;
   _networkId = chan._networkId;
   _serviceId = chan._serviceId;
   _transportId = chan._transportId;
   _pmtPid = chan._pmtPid;
   _lcn = chan._lcn;
   _isRadio = chan._isRadio;
   _isTv = chan._isTv;
   _freeToAir = chan._freeToAir;
 }
Beispiel #4
0
 public TuningDetail GetTuningDetail(DVBBaseChannel channel)
 {
   int channelType = GetChannelType(channel);
   return GetTuningDetail(channel.NetworkId, channel.TransportId, channel.ServiceId, channelType);
 }
Beispiel #5
0
    public static int GetChannelType(DVBBaseChannel channel)
    {
      int channelType;

      if (channel is DVBTChannel)
      {
        channelType = 4;
      }
      else if (channel is DVBSChannel)
      {
        channelType = 3;
      }
      else if (channel is DVBCChannel)
      {
        channelType = 2;
      }
      else if (channel is DVBIPChannel)
      {
        channelType = 7;
      }
      else // must be ATSCChannel
      {
        channelType = 1;
      }
      return channelType;
    }
 /// <summary>
 /// Instructs the cam/ci module to use hardware filter and only send the pids listed in pids to the pc
 /// </summary>
 /// <param name="subChannel">The sub channel id</param>
 /// <param name="channel">The current tv/radio channel.</param>
 /// <param name="HwPids">The pids.</param>
 /// <remarks>when the pids array is empty, pid filtering is disabled and all pids are received</remarks>
 public void SendPids(int subChannel, TvLibrary.Channels.DVBBaseChannel channel, List <ushort> HwPids)
 {
 }
    /// <summary>
    /// Instructs the cam/ci module to use hardware filter and only send the pids listed in pids to the pc
    /// </summary>
    /// <param name="subChannel">The sub channel id</param>
    /// <param name="channel">The current tv/radio channel.</param>
    /// <param name="pids">The pids.</param>
    /// <remarks>when the pids array is empty, pid filtering is disabled and all pids are received</remarks>
    public void SendPids(int subChannel, DVBBaseChannel channel, List<ushort> pids)
    {
      try
      {
        List<ushort> HwPids = new List<ushort>();

        _mapSubChannels[subChannel].HwPids = pids;

        Dictionary<int, ConditionalAccessContext>.Enumerator enSubch = _mapSubChannels.GetEnumerator();
        while (enSubch.MoveNext())
        {
          List<ushort> enPid = enSubch.Current.Value.HwPids;
          if (enPid != null)
          {
            for (int i = 0; i < enPid.Count; ++i)
            {
              if (!HwPids.Contains(enPid[i]))
                HwPids.Add(enPid[i]);
            }
          }
        }

        if (_digitalEveryWhere != null)
        {
          bool isDvbc = ((channel as DVBCChannel) != null);
          bool isDvbt = ((channel as DVBTChannel) != null);
          bool isDvbs = ((channel as DVBSChannel) != null);
          bool isAtsc = ((channel as ATSCChannel) != null);

          // It is not ideal to have to enable hardware PID filtering because
          // doing so can limit the number of channels that can be viewed/recorded
          // simultaneously. However, it does seem that there is a need for filtering
          // on transponders with high data rates. Problems have been observed with
          // transponders on Thor 5/6, Intelsat 10-02 (0.8W) if the filter is not enabled:
          //   Symbol Rate: 27500, Modulation: 8 PSK, FEC rate: 5/6, Pilot: On, Roll-Off: 0.35
          //   Symbol Rate: 30000, Modulation: 8 PSK, FEC rate: 3/4, Pilot: On, Roll-Off: 0.35
          if (pids.Count != 0 && isDvbs &&
              (((DVBSChannel)channel).ModulationType == ModulationType.Mod8Psk ||
              ((DVBSChannel)channel).ModulationType == ModulationType.Mod16Apsk ||
              ((DVBSChannel)channel).ModulationType == ModulationType.Mod32Apsk)
          )
          {
            for (int i = 0; i < HwPids.Count; ++i)
            {
              Log.Log.Info("FireDTV: HW Filtered Pid : 0x{0:X}", HwPids[i]);
            }
            _digitalEveryWhere.SetHardwarePidFiltering(isDvbc, isDvbt, true, isAtsc, HwPids);
          }
          else
          {
            pids.Clear();
            Log.Log.Info("FireDTV: HW Filtering disabled.");
            _digitalEveryWhere.SetHardwarePidFiltering(isDvbc, isDvbt, isDvbs, isAtsc, pids);
          }
        }
      }
      catch (Exception ex)
      {
        Log.Log.Write(ex);
      }
    }
    /// <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;
    }
    public static bool IsUserOnSameChannel(IChannel tuningDetail, TvBusinessLayer layer, DVBBaseChannel userDVBchannel)
    {
      bool isUserOnSameChannel = false;      
      if (userDVBchannel != null)
      {        
        var currentDVBchannel = tuningDetail as DVBBaseChannel;
        if (currentDVBchannel != null)
        {
          TuningDetail currentDVBtuningDetail = layer.GetTuningDetail(currentDVBchannel);
          TuningDetail userDVBtuningDetail = layer.GetTuningDetail(userDVBchannel);
          isUserOnSameChannel = (currentDVBtuningDetail != null && currentDVBtuningDetail.IdChannel == userDVBtuningDetail.IdChannel);

        }        
      }
      return isUserOnSameChannel;
    }