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); }