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); }
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); }
internal override bool SetDVBS2Parameters(TuningSpec tuningSpec, IBaseFilter tunerFilter, ITuneRequest tuneRequest) { if (!dvbs2Capable) { return(true); } IBDA_DigitalDemodulator demodulator = FindDemodulator("Hauppauge", tunerFilter); if (demodulator == null) { Logger.Instance.Write("Hauppauge DVB-S2 handler: Demodulator not located"); return(false); } ModulationType modulationType = ModulationType.ModNotSet; switch (tuningSpec.Modulation) { case Modulation.QPSK: BinaryConvolutionCodeRate codeRate; reply = demodulator.get_InnerFECRate(out codeRate); if (reply != 0) { Logger.Instance.Write("Hauppauge DVB-S2 handler: Get FEC rate failed error code 0x" + reply.ToString("X")); return(false); } if (codeRate == BinaryConvolutionCodeRate.Rate9_10) { modulationType = ModulationType.Mod32Qam; } else { if (codeRate == BinaryConvolutionCodeRate.Rate8_9) { modulationType = ModulationType.Mod16Qam; } else { modulationType = ModulationType.ModBpsk; } } 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("Hauppauge DVB-S2 handler: Set Modulation Type failed error code 0x" + reply.ToString("X")); return(false); } else { Logger.Instance.Write("Hauppauge DVB-S2 handler: Modulation type changed to " + modulationType); } } else { Logger.Instance.Write("Hauppauge DVB-S2 handler: Modulation type not changed"); } IntPtr commandBuffer = Marshal.AllocCoTaskMem(1024); IntPtr instanceBuffer = Marshal.AllocCoTaskMem(1024); SatelliteFrequency frequency = tuningSpec.Frequency as SatelliteFrequency; string setting; if (frequency.SymbolRate != 30000) { Marshal.WriteInt32(commandBuffer, (int)DsUtils.GetNativePilot(frequency.Pilot)); setting = frequency.Pilot.ToString(); } else { Logger.Instance.Write("Hauppauge DVB-S2 handler: Setting pilot to off for symbol rate of 30000"); Marshal.WriteInt32(commandBuffer, (int)DirectShowAPI.Pilot.Off); setting = "Off"; } reply = propertySet.Set(bdaTunerExtensionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_PILOT, instanceBuffer, 32, commandBuffer, 4); if (reply != 0) { Logger.Instance.Write("Hauppauge DVB-S2 handler: Set Pilot command failed error code 0x" + reply.ToString("X")); return(false); } else { Logger.Instance.Write("Hauppauge DVB-S2 handler: Pilot set to " + setting); Marshal.WriteInt32(commandBuffer, (int)DsUtils.GetNativeRollOff(frequency.RollOff)); reply = propertySet.Set(bdaTunerExtensionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_ROLL_OFF, instanceBuffer, 32, commandBuffer, 4); if (reply != 0) { Logger.Instance.Write("Hauppauge DVB-S2 handler: Set Rolloff command failed error code 0x" + reply.ToString("X")); return(false); } else { Logger.Instance.Write("Hauppauge DVB-S2 handler: Rolloff set to " + frequency.RollOff); } } return(true); }