public DVBTTuning() { InitializeComponent(); int hr = 0; this.tuningSpace = (IDVBTuningSpace) new DVBTuningSpace(); hr = this.tuningSpace.put_UniqueName("DVBT TuningSpace"); hr = this.tuningSpace.put_FriendlyName("DVBT TuningSpace"); hr = this.tuningSpace.put__NetworkType(typeof(DVBTNetworkProvider).GUID); hr = this.tuningSpace.put_SystemType(DVBSystemType.Terrestrial); ITuneRequest tr = null; hr = this.tuningSpace.CreateTuneRequest(out tr); DsError.ThrowExceptionForHR(hr); this.tuneRequest = (IDVBTuneRequest)tr; hr = this.tuneRequest.put_ONID(-1); hr = this.tuneRequest.put_TSID(-1); hr = this.tuneRequest.put_SID(-1); IDVBTLocator locator = (IDVBTLocator) new DVBTLocator(); hr = locator.put_CarrierFrequency(-1); hr = tr.put_Locator(locator as ILocator); }
public DVBTTuning() { InitializeComponent(); int hr = 0; this.tuningSpace = (IDVBTuningSpace) new DVBTuningSpace(); hr = this.tuningSpace.put_UniqueName("DVBT TuningSpace"); hr = this.tuningSpace.put_FriendlyName("DVBT TuningSpace"); hr = this.tuningSpace.put__NetworkType(typeof(DVBTNetworkProvider).GUID); hr = this.tuningSpace.put_SystemType(DVBSystemType.Terrestrial); ITuneRequest tr = null; hr = this.tuningSpace.CreateTuneRequest(out tr); DsError.ThrowExceptionForHR(hr); this.tuneRequest = (IDVBTuneRequest) tr; hr = this.tuneRequest.put_ONID(-1); hr = this.tuneRequest.put_TSID(-1); hr = this.tuneRequest.put_SID(-1); IDVBTLocator locator = (IDVBTLocator) new DVBTLocator(); hr = locator.put_CarrierFrequency(-1); hr = tr.put_Locator(locator as ILocator); }
public void DoTests() { try { // No special HW required for this sample tuningSpace = (IDVBTuningSpace)BDAUtils.GetTuningSpace(BDANetworkType.DVBT); TestSystemType(); } finally { Marshal.ReleaseComObject(tuningSpace); } }
/// <summary> /// Nettoyage des ressources utilisées. /// </summary> protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } // Release the COM objects if (this.tuneRequest != null) { Marshal.ReleaseComObject(this.tuneRequest); this.tuneRequest = null; } if (this.tuningSpace != null) { Marshal.ReleaseComObject(this.tuningSpace); this.tuningSpace = null; } } base.Dispose(disposing); }
/// <summary> /// Creates the tuning space. /// </summary> protected void CreateTuningSpace() { Log.Log.WriteFile("dvbt:CreateTuningSpace()"); ITuner tuner = (ITuner)_filterNetworkProvider; SystemTuningSpaces systemTuningSpaces = new SystemTuningSpaces(); ITuningSpaceContainer container = systemTuningSpaces as ITuningSpaceContainer; if (container == null) { Log.Log.Error("CreateTuningSpace() Failed to get ITuningSpaceContainer"); return; } IEnumTuningSpaces enumTuning; ITuningSpace[] spaces = new ITuningSpace[2]; ITuneRequest request; container.get_EnumTuningSpaces(out enumTuning); while (true) { int fetched; enumTuning.Next(1, spaces, out fetched); if (fetched != 1) { break; } string name; spaces[0].get_UniqueName(out name); if (name == "MediaPortal DVBT TuningSpace") { Log.Log.WriteFile("dvbt:found correct tuningspace {0}", name); _tuningSpace = (IDVBTuningSpace)spaces[0]; tuner.put_TuningSpace(_tuningSpace); _tuningSpace.CreateTuneRequest(out request); _tuneRequest = (IDVBTuneRequest)request; return; } Release.ComObject("ITuningSpace", spaces[0]); } Release.ComObject("IEnumTuningSpaces", enumTuning); Log.Log.WriteFile("dvbt:Create new tuningspace"); _tuningSpace = (IDVBTuningSpace) new DVBTuningSpace(); IDVBTuningSpace tuningSpace = (IDVBTuningSpace)_tuningSpace; tuningSpace.put_UniqueName("MediaPortal DVBT TuningSpace"); tuningSpace.put_FriendlyName("MediaPortal DVBT TuningSpace"); tuningSpace.put__NetworkType(typeof(DVBTNetworkProvider).GUID); tuningSpace.put_SystemType(DVBSystemType.Terrestrial); IDVBTLocator locator = (IDVBTLocator) new DVBTLocator(); locator.put_CarrierFrequency(-1); locator.put_InnerFEC(FECMethod.MethodNotSet); locator.put_InnerFECRate(BinaryConvolutionCodeRate.RateNotSet); locator.put_Modulation(ModulationType.ModNotSet); locator.put_OuterFEC(FECMethod.MethodNotSet); locator.put_OuterFECRate(BinaryConvolutionCodeRate.RateNotSet); locator.put_SymbolRate(-1); object newIndex; _tuningSpace.put_DefaultLocator(locator); container.Add(_tuningSpace, out newIndex); tuner.put_TuningSpace(_tuningSpace); Release.ComObject("ITuningSpaceContainer", container); _tuningSpace.CreateTuneRequest(out request); _tuneRequest = request; }