private void TestFEC()
        {
            int       hr = 0;
            FECMethod fecMethod2, fecMethod1 = FECMethod.Viterbi;
            BinaryConvolutionCodeRate fecRate2, fecRate1 = BinaryConvolutionCodeRate.Rate2_3;

            hr = digitalDemux.put_InnerFECMethod(ref fecMethod1);
            //DsError.ThrowExceptionForHR(hr);

            hr = digitalDemux.get_InnerFECMethod(out fecMethod2);
            //DsError.ThrowExceptionForHR(hr);

            hr = digitalDemux.put_InnerFECRate(ref fecRate1);
            //DsError.ThrowExceptionForHR(hr);

            hr = digitalDemux.get_InnerFECRate(out fecRate2);
            //DsError.ThrowExceptionForHR(hr);

            hr = digitalDemux.put_OuterFECMethod(ref fecMethod1);
            //DsError.ThrowExceptionForHR(hr);

            hr = digitalDemux.get_OuterFECMethod(out fecMethod2);
            //DsError.ThrowExceptionForHR(hr);

            hr = digitalDemux.put_OuterFECRate(ref fecRate1);
            //DsError.ThrowExceptionForHR(hr);

            hr = digitalDemux.get_OuterFECRate(out fecRate2);
            //DsError.ThrowExceptionForHR(hr);
        }
Exemple #2
0
 public void OnModulationMode(AtscTransmissionMedium transmissionMedium, byte index, TransmissionSystem transmissionSystem,
                              BinaryConvolutionCodeRate innerCodingMode, bool isSplitBitstreamMode, ModulationType modulationFormat, int symbolRate)
 {
     if (transmissionMedium != AtscTransmissionMedium.Cable)
     {
         return;
     }
     _modulationModes[index] = modulationFormat;
 }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DVBSChannel"/> class.
 /// </summary>
 public DVBSChannel()
 {
     SwitchingFrequency = 0;
     DisEqc             = DisEqcType.SimpleA;
     _bandType          = BandType.Universal;
     _satelliteIndex    = -1;
     _modulation        = ModulationType.ModQpsk;
     _innerFecRate      = BinaryConvolutionCodeRate.RateNotSet;
     _pilot             = Pilot.NotSet;
     _rollOff           = RollOff.NotSet;
 }
        private TFEC Translate(BinaryConvolutionCodeRate fec)
        {
            switch (fec)
            {
            case BinaryConvolutionCodeRate.Rate1_2:
                return(TFEC.TFEC_1_2);

            case BinaryConvolutionCodeRate.Rate2_3:
                return(TFEC.TFEC_2_3);

            case BinaryConvolutionCodeRate.Rate3_4:
                return(TFEC.TFEC_3_4);

            case BinaryConvolutionCodeRate.Rate3_5:
                return(TFEC.TFEC_3_5);

            case BinaryConvolutionCodeRate.Rate4_5:
                return(TFEC.TFEC_4_5);

            case BinaryConvolutionCodeRate.Rate5_6:
                return(TFEC.TFEC_5_6);

            case BinaryConvolutionCodeRate.Rate5_11:
                return(TFEC.TFEC_5_11);

            case BinaryConvolutionCodeRate.Rate7_8:
                return(TFEC.TFEC_7_8);

            case BinaryConvolutionCodeRate.Rate1_4:
                return(TFEC.TFEC_1_4);

            case BinaryConvolutionCodeRate.Rate1_3:
                return(TFEC.TFEC_1_3);

            case BinaryConvolutionCodeRate.Rate2_5:
                return(TFEC.TFEC_2_5);

            case BinaryConvolutionCodeRate.Rate6_7:
                return(TFEC.TFEC_6_7);

            case BinaryConvolutionCodeRate.Rate8_9:
                return(TFEC.TFEC_8_9);

            case BinaryConvolutionCodeRate.Rate9_10:
                return(TFEC.TFEC_9_10);

            case BinaryConvolutionCodeRate.RateMax:
            default:
                return(TFEC.TFEC_AUTO);
            }
        }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DVBSChannel"/> class.
 /// </summary>
 /// <param name="chan">The chan.</param>
 public DVBSChannel(DVBSChannel chan)
     : base(chan)
 {
     _polarisation       = chan.Polarisation;
     _symbolRate         = chan.SymbolRate;
     _switchingFrequency = chan.SwitchingFrequency;
     DisEqc          = chan.DisEqc;
     _bandType       = chan.BandType;
     _modulation     = chan.ModulationType;
     _innerFecRate   = chan.InnerFecRate;
     _pilot          = chan.Pilot;
     _rollOff        = chan.Rolloff;
     _satelliteIndex = chan.SatelliteIndex;
 }
Exemple #6
0
        /// <summary>
        /// Sets the DVB-S2 parameters such as modulation, roll-off, pilot etc.
        /// </summary>
        /// <param name="parameters">The LNB parameters.</param>
        /// <param name="channel">The channel to tune.</param>
        /// <returns>The channel with DVB-S2 parameters set.</returns>
        public DVBSChannel SetDVBS2Modulation(ScanParameters parameters, DVBSChannel channel)
        {
            //Log.Log.WriteFile("Trying to set DVB-S2 modulation...");
            try
            {
                if (_twinhan != null)
                {
                    //DVB-S2 modulation parameters for Twinhan
                    if (channel.ModulationType == ModulationType.ModQpsk)
                    {
                        channel.ModulationType = ModulationType.Mod8Vsb;
                    }
                    if (channel.ModulationType == ModulationType.Mod8Psk)
                    {
                        channel.ModulationType = ModulationType.Mod8Vsb;
                    }
                    if (channel.ModulationType == ModulationType.Mod16Apsk)
                    {
                        channel.ModulationType = ModulationType.Mod16Vsb;
                    }
                    if (channel.ModulationType == ModulationType.Mod32Apsk)
                    {
                        channel.ModulationType = ModulationType.ModOqpsk;
                    }
                    Log.Log.WriteFile("Twinhan DVB-S2 modulation set to:{0}", channel.ModulationType);
                    Log.Log.WriteFile("Twinhan DVB-S2 Pilot set to:{0}", channel.Pilot);
                    Log.Log.WriteFile("Twinhan DVB-S2 RollOff set to:{0}", channel.Rolloff);
                    Log.Log.WriteFile("Twinhan DVB-S2 fec set to:{0}", channel.InnerFecRate);
                    return(channel);
                }
                if (_hauppauge != null)
                {
                    //Set Hauppauge pilot, roll-off settings but only if DVB-S2
                    //We assume if the modulation is set then a DVB-S2 tuning request has been requested
                    if (channel.ModulationType != ModulationType.ModNotSet)
                    {
                        //Set the alternative Hauppauge Modulation type
                        if (channel.ModulationType == ModulationType.ModQpsk)
                        {
                            if (channel.InnerFecRate == BinaryConvolutionCodeRate.Rate9_10)
                            {
                                channel.ModulationType = ModulationType.Mod32Qam;
                            }
                            channel.ModulationType = channel.InnerFecRate == BinaryConvolutionCodeRate.Rate8_9
                                         ? ModulationType.Mod16Qam
                                         : ModulationType.ModBpsk;
                        }
                        //Set the Hauppauge Modulation type

                        /*if (channel.ModulationType == ModulationType.ModQpsk)
                         * {
                         * channel.ModulationType = ModulationType.ModQpsk2;
                         * }*/
                        if (channel.ModulationType == ModulationType.Mod8Psk)
                        {
                            channel.ModulationType = ModulationType.ModNbc8Psk;
                        }
                        if (channel.SymbolRate == 30000)
                        {
                            channel.Pilot = Pilot.Off;
                        }
                        Log.Log.WriteFile("Hauppauge DVB-S2 modulation set to:{0}", channel.ModulationType);
                        Log.Log.WriteFile("Hauppauge DVB-S2 Pilot set to:{0}", channel.Pilot);
                        Log.Log.WriteFile("Hauppauge DVB-S2 RollOff set to:{0}", channel.Rolloff);
                        Log.Log.WriteFile("Hauppauge DVB-S2 fec set to:{0}", channel.InnerFecRate);
                        _hauppauge.SetDVBS2PilotRolloff(channel);
                    }
                    return(channel);
                }
                if (_profred != null)
                {
                    //Set ProfRed pilot, roll-off settings
                    if (channel.ModulationType == ModulationType.ModNotSet)
                    {
                        channel.ModulationType = ModulationType.ModNotDefined;
                    }
                    if (channel.ModulationType == ModulationType.Mod8Psk)
                    {
                        channel.ModulationType = ModulationType.ModBpsk;
                    }
                    Log.Log.WriteFile("ProfRed DVB-S2 modulation set to:{0}", channel.ModulationType);
                    Log.Log.WriteFile("ProfRed DVB-S2 Pilot set to:{0}", channel.Pilot);
                    Log.Log.WriteFile("ProfRed DVB-S2 RollOff set to:{0}", channel.Rolloff);
                    Log.Log.WriteFile("ProfRed DVB-S2 fec set to:{0}", channel.InnerFecRate);
                    //}
                    return(channel);
                }
                if (_technoTrend != null)
                {
                    //Set TechnoTrend modulation tuning settings
                    if (channel.ModulationType == ModulationType.ModQpsk)
                    {
                        channel.ModulationType = ModulationType.Mod8Vsb;
                    }
                    if (channel.ModulationType == ModulationType.Mod8Psk)
                    {
                        channel.ModulationType = ModulationType.Mod8Vsb;
                    }
                    if (channel.ModulationType == ModulationType.Mod16Apsk)
                    {
                        channel.ModulationType = ModulationType.Mod16Vsb;
                    }
                    if (channel.ModulationType == ModulationType.Mod32Apsk)
                    {
                        channel.ModulationType = ModulationType.ModOqpsk;
                    }
                    Log.Log.WriteFile("Technotrend DVB-S2 modulation set to:{0}", channel.ModulationType);
                    Log.Log.WriteFile("Technotrend DVB-S2 Pilot set to:{0}", channel.Pilot);
                    Log.Log.WriteFile("Technotrend DVB-S2 RollOff set to:{0}", channel.Rolloff);
                    Log.Log.WriteFile("Technotrend DVB-S2 fec set to:{0}", channel.InnerFecRate);
                    return(channel);
                }
                if (_knc != null)
                {
                    //Set KNC modulation tuning settings
                    if (channel.ModulationType == ModulationType.ModQpsk)
                    {
                        channel.ModulationType = ModulationType.Mod8Vsb;
                    }
                    if (channel.ModulationType == ModulationType.Mod8Psk)
                    {
                        channel.ModulationType = ModulationType.Mod8Vsb;
                    }
                    if (channel.ModulationType == ModulationType.Mod16Apsk)
                    {
                        channel.ModulationType = ModulationType.Mod16Vsb;
                    }
                    if (channel.ModulationType == ModulationType.Mod32Apsk)
                    {
                        channel.ModulationType = ModulationType.ModOqpsk;
                    }
                    Log.Log.WriteFile("KNC DVB-S2 modulation set to:{0}", channel.ModulationType);
                    Log.Log.WriteFile("KNC DVB-S2 Pilot set to:{0}", channel.Pilot);
                    Log.Log.WriteFile("KNC DVB-S2 RollOff set to:{0}", channel.Rolloff);
                    Log.Log.WriteFile("KNC DVB-S2 fec set to:{0}", channel.InnerFecRate);
                    return(channel);
                }
                if (_digitalEveryWhere != null)
                {
                    if (channel.ModulationType == ModulationType.ModQpsk)
                    {
                        channel.ModulationType = ModulationType.ModNbcQpsk;
                    }
                    if (channel.ModulationType == ModulationType.Mod8Psk)
                    {
                        channel.ModulationType = ModulationType.ModNbc8Psk;
                    }
                    //Check if DVB-S channel if not turn off Pilot & Roll-off regardless
                    if (channel.ModulationType == ModulationType.ModNotSet)
                    {
                        channel.Pilot   = Pilot.NotSet;
                        channel.Rolloff = RollOff.NotSet;
                        //Log.Log.WriteFile("DigitalEverywhere: we're tuning DVB-S, pilot & roll-off are now not set");
                    }

                    if (channel.InnerFecRate != BinaryConvolutionCodeRate.RateNotSet)
                    {
                        //Set the DigitalEverywhere binary values for Pilot & Roll-off
                        int _pilot   = 0;
                        int _rollOff = 0;
                        if (channel.Pilot == Pilot.On)
                        {
                            _pilot = 128;
                        }
                        if (channel.Pilot == Pilot.Off)
                        {
                            _pilot = 64;
                        }
                        if (channel.Rolloff == RollOff.Twenty)
                        {
                            _rollOff = 16;
                        }
                        if (channel.Rolloff == RollOff.TwentyFive)
                        {
                            _rollOff = 32;
                        }
                        if (channel.Rolloff == RollOff.ThirtyFive)
                        {
                            _rollOff = 48;
                        }
                        //The binary values get added to the current InnerFECRate - done!
                        BinaryConvolutionCodeRate r = channel.InnerFecRate + _pilot + _rollOff;
                        channel.InnerFecRate = r;
                    }
                    Log.Log.WriteFile("DigitalEverywhere DVB-S2 modulation set to:{0}", channel.ModulationType);
                    Log.Log.WriteFile("DigitalEverywhere Pilot set to:{0}", channel.Pilot);
                    Log.Log.WriteFile("DigitalEverywhere RollOff set to:{0}", channel.Rolloff);
                    Log.Log.WriteFile("DigitalEverywhere fec set to:{0}", (int)channel.InnerFecRate);
                    return(channel);
                }
            }
            catch (Exception ex)
            {
                Log.Log.Write(ex);
            }
            return(channel);
        }
Exemple #7
0
        internal override bool SetDVBS2Parameters(TuningSpec tuningSpec, IBaseFilter tunerFilter, ITuneRequest tuneRequest)
        {
            if (!dvbs2Capable)
            {
                return(true);
            }

            IBDA_DigitalDemodulator demodulator = FindDemodulator("DigitalEverywhere", tunerFilter);

            if (demodulator == null)
            {
                Logger.Instance.Write("DigitalEverywhere DVB-S2 handler: Demodulator not located");
                return(false);
            }

            ModulationType modulationType = ModulationType.ModNotSet;

            switch (tuningSpec.Modulation)
            {
            case Modulation.QPSK:
                modulationType = ModulationType.ModNbcQpsk;
                break;

            case Modulation.PSK8:
                modulationType = ModulationType.ModNbc8Psk;
                break;

            default:
                break;
            }

            if (modulationType != ModulationType.ModNotSet)
            {
                reply = demodulator.put_ModulationType(ref modulationType);
                if (reply != 0)
                {
                    Logger.Instance.Write("DigitalEverywhere DVB-S2 handler: Set Modulation Type failed error code 0x" + reply.ToString("X"));
                    return(false);
                }
                else
                {
                    Logger.Instance.Write("DigitalEverywhere DVB-S2 handler: Modulation type changed to " + modulationType);
                }
            }
            else
            {
                Logger.Instance.Write("DigitalEverywhere DVB-S2 handler: Modulation type not changed");
            }

            BinaryConvolutionCodeRate oldCodeRate;

            reply = demodulator.get_InnerFECRate(out oldCodeRate);
            if (reply != 0)
            {
                Logger.Instance.Write("DigitalEverywhere DVB-S2 handler: Get FEC Rate failed error code 0x" + reply.ToString("X"));
                return(false);
            }

            SatelliteFrequency satelliteFrequency = tuningSpec.Frequency as SatelliteFrequency;

            BinaryConvolutionCodeRate newCodeRate = oldCodeRate;

            if (satelliteFrequency.Pilot == DomainObjects.Pilot.Off)
            {
                newCodeRate += 64;
            }
            else
            {
                if (satelliteFrequency.Pilot == DomainObjects.Pilot.On)
                {
                    newCodeRate += 128;
                }
            }

            switch (satelliteFrequency.RollOff)
            {
            case DomainObjects.RollOff.RollOff20:
                newCodeRate += 16;
                break;

            case DomainObjects.RollOff.RollOff25:
                newCodeRate += 32;
                break;

            case DomainObjects.RollOff.RollOff35:
                newCodeRate += 48;
                break;

            default:
                break;
            }

            if (oldCodeRate != newCodeRate)
            {
                reply = demodulator.put_InnerFECRate(newCodeRate);
                if (reply != 0)
                {
                    Logger.Instance.Write("DigitalEverywhere DVB-S2 handler: Set FEC Rate failed error code 0x" + reply.ToString("X"));
                    return(false);
                }

                Logger.Instance.Write("DigitalEverywhere DVB-S2 handler: FEC Rate changed from " + oldCodeRate + " to " + newCodeRate);
            }

            return(true);
        }
        private void DecodeModulationMode(byte[] section, int endOfSection, ref int pointer, ref byte firstIndex, AtscTransmissionMedium transmissionMedium)
        {
            if (pointer + 6 > endOfSection)
            {
                throw new Exception(string.Format("NIT: corruption detected at modulation mode, pointer = {0}, end of section = {1}", pointer, endOfSection));
            }
            TransmissionSystem        transmissionSystem = (TransmissionSystem)(section[pointer] >> 4);
            BinaryConvolutionCodeRate innerCodingMode    = BinaryConvolutionCodeRate.RateNotDefined;

            switch (section[pointer] & 0x0f)
            {
            case 0:
                innerCodingMode = BinaryConvolutionCodeRate.Rate5_11;
                break;

            case 1:
                innerCodingMode = BinaryConvolutionCodeRate.Rate1_2;
                break;

            case 3:
                innerCodingMode = BinaryConvolutionCodeRate.Rate3_5;
                break;

            case 5:
                innerCodingMode = BinaryConvolutionCodeRate.Rate2_3;
                break;

            case 7:
                innerCodingMode = BinaryConvolutionCodeRate.Rate3_4;
                break;

            case 8:
                innerCodingMode = BinaryConvolutionCodeRate.Rate4_5;
                break;

            case 9:
                innerCodingMode = BinaryConvolutionCodeRate.Rate5_6;
                break;

            case 11:
                innerCodingMode = BinaryConvolutionCodeRate.Rate7_8;
                break;

            case 15:
                // concatenated coding not used
                innerCodingMode = BinaryConvolutionCodeRate.RateNotSet;
                break;
            }
            pointer++;

            bool           isSplitBitstreamMode = ((section[pointer] & 0x80) != 0);
            ModulationType modulationFormat     = ModulationType.ModNotSet;

            switch (section[pointer] & 0x1f)
            {
            case 1:
                modulationFormat = ModulationType.ModQpsk;
                break;

            case 2:
                modulationFormat = ModulationType.ModBpsk;
                break;

            case 3:
                modulationFormat = ModulationType.ModOqpsk;
                break;

            case 4:
                modulationFormat = ModulationType.Mod8Vsb;
                break;

            case 5:
                modulationFormat = ModulationType.Mod16Vsb;
                break;

            case 6:
                modulationFormat = ModulationType.Mod16Qam;
                break;

            case 7:
                modulationFormat = ModulationType.Mod32Qam;
                break;

            case 8:
                modulationFormat = ModulationType.Mod64Qam;
                break;

            case 9:
                modulationFormat = ModulationType.Mod80Qam;
                break;

            case 10:
                modulationFormat = ModulationType.Mod96Qam;
                break;

            case 11:
                modulationFormat = ModulationType.Mod112Qam;
                break;

            case 12:
                modulationFormat = ModulationType.Mod128Qam;
                break;

            case 13:
                modulationFormat = ModulationType.Mod160Qam;
                break;

            case 14:
                modulationFormat = ModulationType.Mod192Qam;
                break;

            case 15:
                modulationFormat = ModulationType.Mod224Qam;
                break;

            case 16:
                modulationFormat = ModulationType.Mod256Qam;
                break;

            case 17:
                modulationFormat = ModulationType.Mod320Qam;
                break;

            case 18:
                modulationFormat = ModulationType.Mod384Qam;
                break;

            case 19:
                modulationFormat = ModulationType.Mod448Qam;
                break;

            case 20:
                modulationFormat = ModulationType.Mod512Qam;
                break;

            case 21:
                modulationFormat = ModulationType.Mod640Qam;
                break;

            case 22:
                modulationFormat = ModulationType.Mod768Qam;
                break;

            case 23:
                modulationFormat = ModulationType.Mod896Qam;
                break;

            case 24:
                modulationFormat = ModulationType.Mod1024Qam;
                break;
            }
            pointer++;

            // s/s
            int symbolRate = ((section[pointer] & 0x0f) << 24) + (section[pointer + 1] << 16) + (section[pointer + 2] << 8) + section[pointer + 3];

            pointer += 4;
            Log.Log.Debug("NIT: modulation mode, transmission system = {0}, inner coding mode = {1}, is split bitstream mode = {2}, modulation format = {3}, symbol rate = {4} s/s",
                          transmissionSystem, innerCodingMode, isSplitBitstreamMode, modulationFormat, symbolRate);

            if (OnModulationMode != null)
            {
                OnModulationMode(transmissionMedium, firstIndex++, transmissionSystem, innerCodingMode, isSplitBitstreamMode, modulationFormat, symbolRate);
            }
        }
Exemple #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DVBSChannel"/> class.
 /// </summary>
 public DVBSChannel()
 {
   SwitchingFrequency = 0;
   DisEqc = DisEqcType.SimpleA;
   _bandType = BandType.Universal;
   _satelliteIndex = -1;
   _modulation = ModulationType.ModQpsk;
   _innerFecRate = BinaryConvolutionCodeRate.RateNotSet;
   _pilot = Pilot.NotSet;
   _rollOff = RollOff.NotSet;
 }
Exemple #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DVBSChannel"/> class.
 /// </summary>
 /// <param name="chan">The chan.</param>
 public DVBSChannel(DVBSChannel chan)
   : base(chan)
 {
   _polarisation = chan.Polarisation;
   _symbolRate = chan.SymbolRate;
   _switchingFrequency = chan.SwitchingFrequency;
   DisEqc = chan.DisEqc;
   _bandType = chan.BandType;
   _modulation = chan.ModulationType;
   _innerFecRate = chan.InnerFecRate;
   _pilot = chan.Pilot;
   _rollOff = chan.Rolloff;
   _satelliteIndex = chan.SatelliteIndex;
 }
Exemple #11
0
 public void OnModulationMode(AtscTransmissionMedium transmissionMedium, byte index, TransmissionSystem transmissionSystem,
   BinaryConvolutionCodeRate innerCodingMode, bool isSplitBitstreamMode, ModulationType modulationFormat, int symbolRate)
 {
   if (transmissionMedium != AtscTransmissionMedium.Cable)
   {
     return;
   }
   _modulationModes[index] = modulationFormat;
 }
Exemple #12
0
 private TFEC Translate(BinaryConvolutionCodeRate fec)
 {
   switch (fec)
   {
     case BinaryConvolutionCodeRate.Rate1_2:
       return TFEC.TFEC_1_2;
     case BinaryConvolutionCodeRate.Rate2_3:
       return TFEC.TFEC_2_3;
     case BinaryConvolutionCodeRate.Rate3_4:
       return TFEC.TFEC_3_4;
     case BinaryConvolutionCodeRate.Rate3_5:
       return TFEC.TFEC_3_5;
     case BinaryConvolutionCodeRate.Rate4_5:
       return TFEC.TFEC_4_5;
     case BinaryConvolutionCodeRate.Rate5_6:
       return TFEC.TFEC_5_6;
     case BinaryConvolutionCodeRate.Rate5_11:
       return TFEC.TFEC_5_11;
     case BinaryConvolutionCodeRate.Rate7_8:
       return TFEC.TFEC_7_8;
     case BinaryConvolutionCodeRate.Rate1_4:
       return TFEC.TFEC_1_4;
     case BinaryConvolutionCodeRate.Rate1_3:
       return TFEC.TFEC_1_3;
     case BinaryConvolutionCodeRate.Rate2_5:
       return TFEC.TFEC_2_5;
     case BinaryConvolutionCodeRate.Rate6_7:
       return TFEC.TFEC_6_7;
     case BinaryConvolutionCodeRate.Rate8_9:
       return TFEC.TFEC_8_9;
     case BinaryConvolutionCodeRate.Rate9_10:
       return TFEC.TFEC_9_10;
     case BinaryConvolutionCodeRate.RateMax:
     default:
       return TFEC.TFEC_AUTO;
   }
 }