public DVBSTuning() { InitializeComponent(); int hr = 0; this.tuningSpace = (IDVBSTuningSpace) new DVBSTuningSpace(); hr = this.tuningSpace.put_UniqueName("DVBS TuningSpace"); hr = this.tuningSpace.put_FriendlyName("DVBS TuningSpace"); hr = this.tuningSpace.put__NetworkType(typeof(DVBSNetworkProvider).GUID); hr = this.tuningSpace.put_SystemType(DVBSystemType.Satellite); hr = this.tuningSpace.put_LowOscillator(9750000); hr = this.tuningSpace.put_HighOscillator(10600000); 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); IDVBSLocator locator = (IDVBSLocator) new DVBSLocator(); hr = locator.put_CarrierFrequency(-1); hr = locator.put_SymbolRate(-1); hr = tr.put_Locator(locator as ILocator); }
public DVBTTuning() { 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(754000); hr = tr.put_Locator(locator as ILocator); }
public void DoTests() { int hr = 0; Config(); string savedTuneRequest; hr = xmlUtility.Serialize(dvbtr, out savedTuneRequest); DsError.ThrowExceptionForHR(hr); object o; // Only test the string version of the method but it's the more conveniant for a .Net usage. hr = xmlUtility.Deserialize(savedTuneRequest, out o); DsError.ThrowExceptionForHR(hr); Debug.Assert(o is IDVBTuneRequest); IDVBTuneRequest dvbtr2 = (IDVBTuneRequest)o; int onid, tsid, sid; dvbtr2.get_ONID(out onid); dvbtr2.get_TSID(out tsid); dvbtr2.get_SID(out sid); Debug.Assert((onid == 8442) && (tsid == 1) && (sid == 259)); }
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); }
private bool BeforeTune(IChannel channel, ref int subChannelId) { DVBCChannel dvbcChannel = channel as DVBCChannel; if (dvbcChannel == null) { Log.Log.WriteFile("dvbc:Channel is not a DVBC channel!!! {0}", channel.GetType().ToString()); return(false); } /*if (CurrentChannel != null) * { * //@FIX this fails for back-2-back recordings * //if (oldChannel.Equals(channel)) return _mapSubChannels[0]; * }*/ if (_graphState == GraphState.Idle) { BuildGraph(); if (_mapSubChannels.ContainsKey(subChannelId) == false) { subChannelId = GetNewSubChannel(channel); } } if (useInternalNetworkProvider) { return(true); } if (_previousChannel == null || _previousChannel.IsDifferentTransponder(dvbcChannel)) { //_pmtPid = -1; ILocator locator; _tuningSpace.get_DefaultLocator(out locator); IDVBCLocator dvbcLocator = (IDVBCLocator)locator; dvbcLocator.put_InnerFEC(FECMethod.MethodNotSet); dvbcLocator.put_InnerFECRate(BinaryConvolutionCodeRate.RateNotSet); dvbcLocator.put_OuterFEC(FECMethod.MethodNotSet); dvbcLocator.put_OuterFECRate(BinaryConvolutionCodeRate.RateNotSet); dvbcLocator.put_Modulation(dvbcChannel.ModulationType); dvbcLocator.put_SymbolRate(dvbcChannel.SymbolRate); IDVBTuneRequest tuneRequest = (IDVBTuneRequest)_tuneRequest; tuneRequest.put_ONID(dvbcChannel.NetworkId); tuneRequest.put_SID(dvbcChannel.ServiceId); tuneRequest.put_TSID(dvbcChannel.TransportId); locator.put_CarrierFrequency((int)dvbcChannel.Frequency); _tuneRequest.put_Locator(locator); _tuneRequest = tuneRequest; } return(true); }
private void Config() { xmlUtility = (IPersistTuneXmlUtility2) new PersistTuneXmlUtility(); IBDACreateTuneRequestEx bdaCtrEx = new DVBTuningSpace() as IBDACreateTuneRequestEx; Debug.Assert(bdaCtrEx != null); ITuneRequest tr; int hr = bdaCtrEx.CreateTuneRequestEx(typeof(IDVBTuneRequest).GUID, out tr); DsError.ThrowExceptionForHR(hr); dvbtr = (IDVBTuneRequest)tr; // Tune request for France 2... dvbtr.put_ONID(8442); dvbtr.put_TSID(1); dvbtr.put_SID(259); }
private bool BeforeTune(IChannel channel, ref int subChannelId) { DVBTChannel dvbtChannel = channel as DVBTChannel; if (dvbtChannel == null) { Log.Log.WriteFile("dvbt:Channel is not a DVBT channel!!! {0}", channel.GetType().ToString()); return(false); } if (_graphState == GraphState.Idle) { BuildGraph(); if (_mapSubChannels.ContainsKey(subChannelId) == false) { subChannelId = GetNewSubChannel(channel); } } if (useInternalNetworkProvider) { return(true); } if (_previousChannel == null || _previousChannel.IsDifferentTransponder(dvbtChannel)) { //_pmtPid = -1; ILocator locator; _tuningSpace.get_DefaultLocator(out locator); IDVBTLocator dvbtLocator = (IDVBTLocator)locator; dvbtLocator.put_Bandwidth(dvbtChannel.BandWidth); IDVBTuneRequest tuneRequest = (IDVBTuneRequest)_tuneRequest; tuneRequest.put_ONID(dvbtChannel.NetworkId); tuneRequest.put_SID(dvbtChannel.ServiceId); tuneRequest.put_TSID(dvbtChannel.TransportId); locator.put_CarrierFrequency((int)dvbtChannel.Frequency); _tuneRequest.put_Locator(locator); } return(true); }
/// <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); }
public void UpdateService(string serviceId, ITuningSpace tuningSpace, IGuideData guideData) { Trace.WriteLineIf(trace.TraceInfo, "EPG.UpdateService(" + serviceId + ")"); if (serviceId == null) { UpdateAllService(guideData); } else if (tuningSpace != null && NeedServiceUpdate(serviceId)) { // serviceId = "ONID:TSID:SID" string[] serviceIds = serviceId.Split(new char[] { ':' }); int onid = int.Parse(serviceIds[0]); int tsid = int.Parse(serviceIds[1]); int sid = int.Parse(serviceIds[2]); ITuneRequest tr; tuningSpace.CreateTuneRequest(out tr); IDVBTuneRequest tuneRequest = (IDVBTuneRequest)tr; tuneRequest.put_ONID(onid); tuneRequest.put_TSID(tsid); tuneRequest.put_SID(sid); UpdateService(tuneRequest, guideData); } }
private void buttonCapture_Click(object sender, RoutedEventArgs e) { _extractFolder = txtTsLocation.Text; if (Directory.Exists(_extractFolder)) { if (Properties.Settings.Default.ExtractDirectory != _extractFolder) { Properties.Settings.Default.ExtractDirectory = _extractFolder; Properties.Settings.Default.Save(); } txtTsLocation.IsEnabled = false; buttonBrowse.IsEnabled = false; // List already downloaded items DirectoryInfo extractDir = new DirectoryInfo(_extractFolder); foreach (DirectoryInfo fwFolder in extractDir.EnumerateDirectories()) { FirmwareFile fwFile = new FirmwareFile(fwFolder.FullName); CompletedFiles.Add(string.Format("{0:X2}-{1:X2}-{2:X2}", fwFile.VendorId, fwFile.ModelId, fwFile.VersionId), fwFile); CompletedFileList.Add(fwFile); } timer.Interval = new TimeSpan(0, 0, 1); timer.Tick += new EventHandler(timer_Tick); timer.Start(); try { // Start BDA Capture int hr = 0; IDVBSTuningSpace tuningSpace; tuningSpace = (IDVBSTuningSpace) new DVBSTuningSpace(); hr = tuningSpace.put_UniqueName("DVBS TuningSpace"); hr = tuningSpace.put_FriendlyName("DVBS TuningSpace"); hr = tuningSpace.put__NetworkType(typeof(DVBSNetworkProvider).GUID); hr = tuningSpace.put_SystemType(DVBSystemType.Satellite); hr = tuningSpace.put_LowOscillator(9750000); hr = tuningSpace.put_HighOscillator(10600000); ITuneRequest tr = null; hr = tuningSpace.CreateTuneRequest(out tr); DsError.ThrowExceptionForHR(hr); IDVBTuneRequest tuneRequest = (IDVBTuneRequest)tr; hr = tuneRequest.put_ONID(2); hr = tuneRequest.put_TSID(2004); hr = tuneRequest.put_SID(4190); IDVBSLocator locator = (IDVBSLocator) new DVBSLocator(); hr = locator.put_CarrierFrequency(11778000); hr = locator.put_SymbolRate(27500000); hr = locator.put_Modulation(ModulationType.ModQpsk); hr = (locator as IDVBSLocator).put_SignalPolarisation(Polarisation.LinearV); hr = (locator as IDVBSLocator).put_InnerFEC(FECMethod.Viterbi); hr = (locator as IDVBSLocator).put_InnerFECRate(BinaryConvolutionCodeRate.Rate2_3); hr = (locator as IDVBSLocator).put_OuterFEC(FECMethod.Viterbi); hr = (locator as IDVBSLocator).put_OuterFECRate(BinaryConvolutionCodeRate.Rate2_3); hr = tr.put_Locator(locator as ILocator); Marshal.ReleaseComObject(locator); this.bdaGraphBuilder = new BDAGraphBuilder(); this.bdaGraphBuilder.BuildGraph(tuningSpace); this.bdaGraphBuilder.SubmitTuneRequest(tr); // We have to do this to make it actually tune! this.bdaGraphBuilder.RunGraph(); this.bdaGraphBuilder.StopGraph(); TsGrabber grabber = new TsGrabber(); grabber.Callback = new TsGrabber.ProcessBufferDelegate(ProcessBuffer); this.bdaGraphBuilder.SetUpForTs(grabber, 1); this.bdaGraphBuilder.RunGraph(); this.buttonCapture.IsEnabled = false; } catch (Exception ex) { MessageBox.Show(string.Format("Error connecting to DVB-S:\n{0}", ex), "Connection error", MessageBoxButton.OK, MessageBoxImage.Error); Close(); } } else { MessageBox.Show("Cannot find extract directory specified!"); } }
private bool BeforeTune(ref int subChannelId, IChannel channel) { DVBSChannel dvbsChannel = channel as DVBSChannel; if (dvbsChannel == null) { Log.Log.WriteFile("Channel is not a DVBS channel!!! {0}", channel.GetType().ToString()); return(false); } /*if (CurrentChannel != null) * { * //@FIX this fails for back-2-back recordings * //if (oldChannel.Equals(channel)) return _mapSubChannels[0]; * }*/ if (dvbsChannel.SwitchingFrequency < 10) { dvbsChannel.SwitchingFrequency = 11700000; } Log.Log.WriteFile("dvbs: Tune:{0}", channel); if (_graphState == GraphState.Idle) { BuildGraph(); } if (_mapSubChannels.ContainsKey(subChannelId) == false) { subChannelId = GetNewSubChannel(channel); } if (useInternalNetworkProvider) { //set the DisEqC parameters if (_conditionalAccess != null) { //int hr2 = ((IMediaControl)_graphBuilder).Pause(); _diseqCsucceded = _conditionalAccess.SendDiseqcCommand(_parameters, dvbsChannel); //hr2 = ((IMediaControl)_graphBuilder).Run(); //move diseqc motor to correct satellite if (dvbsChannel != null && dvbsChannel.SatelliteIndex > 0 && _conditionalAccess.DiSEqCMotor != null) { _conditionalAccess.DiSEqCMotor.GotoPosition((byte)dvbsChannel.SatelliteIndex); } } return(true); } if (_previousChannel == null || _previousChannel.IsDifferentTransponder(dvbsChannel)) { //_pmtPid = -1; ILocator locator; int lowOsc; int hiOsc; int lnbSwitch; BandTypeConverter.GetDefaultLnbSetup(Parameters, dvbsChannel.BandType, out lowOsc, out hiOsc, out lnbSwitch); Log.Log.Info("LNB low:{0} hi:{1} switch:{2}", lowOsc, hiOsc, lnbSwitch); if (lnbSwitch == 0) { lnbSwitch = 18000; } IDVBSTuningSpace tuningSpace = (IDVBSTuningSpace)_tuningSpace; tuningSpace.put_LNBSwitch(lnbSwitch * 1000); tuningSpace.put_LowOscillator(lowOsc * 1000); tuningSpace.put_HighOscillator(hiOsc * 1000); ITuneRequest request; _tuningSpace.CreateTuneRequest(out request); _tuneRequest = (IDVBTuneRequest)request; _tuningSpace.get_DefaultLocator(out locator); IDVBSLocator dvbsLocator = (IDVBSLocator)locator; IDVBTuneRequest tuneRequest = (IDVBTuneRequest)_tuneRequest; tuneRequest.put_ONID(dvbsChannel.NetworkId); tuneRequest.put_SID(dvbsChannel.ServiceId); tuneRequest.put_TSID(dvbsChannel.TransportId); locator.put_CarrierFrequency((int)dvbsChannel.Frequency); dvbsLocator.put_SymbolRate(dvbsChannel.SymbolRate); dvbsLocator.put_SignalPolarisation(dvbsChannel.Polarisation); // Set DVB-S2 and manufacturer specific tuning parameters here. //------------------------------------------------------------------- // Important: the original dvbsChannel object *must not* be modified // otherwise IsDifferentTransponder() will sometimes returns true // when it shouldn't. See mantis 0002979. //------------------------------------------------------------------- DVBSChannel tuneChannel = new DVBSChannel(dvbsChannel); if (_conditionalAccess != null) { tuneChannel = _conditionalAccess.SetDVBS2Modulation(_parameters, tuneChannel); } dvbsLocator.put_Modulation(tuneChannel.ModulationType); Log.Log.WriteFile("dvbs:channel modulation is set to {0}", tuneChannel.ModulationType); dvbsLocator.put_InnerFECRate(tuneChannel.InnerFecRate); Log.Log.WriteFile("dvbs:channel FECRate is set to {0}", tuneChannel.InnerFecRate); _tuneRequest.put_Locator(locator); //set the DisEqC parameters if (_conditionalAccess != null) { //int hr2 = ((IMediaControl)_graphBuilder).Pause(); _diseqCsucceded = _conditionalAccess.SendDiseqcCommand(_parameters, dvbsChannel); //hr2 = ((IMediaControl)_graphBuilder).Run(); //move diseqc motor to correct satellite if (dvbsChannel != null && dvbsChannel.SatelliteIndex > 0 && _conditionalAccess.DiSEqCMotor != null) { _conditionalAccess.DiSEqCMotor.GotoPosition((byte)dvbsChannel.SatelliteIndex); } } } _dvbsChannel = dvbsChannel; return(true); }