Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private void MakeATuneRequestAndRunTheGraph()
        {
            int      hr = 0;
            ILocator locator;

            // Assume a DVBT hardware.
            // Those values are valid for me but must be modified to be valid depending on your location
            hr = tuneRequest.get_Locator(out locator);
            DsError.ThrowExceptionForHR(hr);

            hr = locator.put_CarrierFrequency(586000);
            DsError.ThrowExceptionForHR(hr);

            hr = tuneRequest.put_Locator(locator);
            DsError.ThrowExceptionForHR(hr);

            Marshal.ReleaseComObject(locator);

            hr = (tuneRequest as IDVBTuneRequest).put_ONID(8442);
            hr = (tuneRequest as IDVBTuneRequest).put_TSID(1);
            hr = (tuneRequest as IDVBTuneRequest).put_SID(260);
            DsError.ThrowExceptionForHR(hr);

            if (tuner.Validate(tuneRequest) == 0)
            {
                hr = tuner.put_TuneRequest(tuneRequest);
                hr = (graphBuilder as IMediaControl).Run();
            }
            else
            {
                Debug.Fail("TuneRequest is not valid");
            }
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        private void TestTuneRequestAndValidate()
        {
            int          hr = 0;
            ITuneRequest tuneRequest;
            ILocator     locator;

            // I have this value as global varible but i have to test get_TuneRequest...
            hr = tuner.get_TuneRequest(out tuneRequest);
            Debug.Assert(hr == 0, "ITuner.get_TuneRequest");

            hr = tuneRequest.get_Locator(out locator);
            DsError.ThrowExceptionForHR(hr);

            // Assume a DVBT hardware
            // A valid carrier frequency must be passed...
            hr = (locator as IDVBTLocator).put_CarrierFrequency(586000);
            hr = tuneRequest.put_Locator(locator);

            // Select the first channel in the first transport stream found...
            hr = (tuneRequest as IDVBTuneRequest).put_ONID(-1);
            hr = (tuneRequest as IDVBTuneRequest).put_TSID(-1);
            hr = (tuneRequest as IDVBTuneRequest).put_SID(-1);

            // Is it a valid tune request ?
            hr = tuner.Validate(tuneRequest);

            Debug.Assert(hr == 0, "ITuner.Validate");

            hr = tuner.put_TuneRequest(tuneRequest);

            Debug.Assert(hr == 0, "ITuner.put_TuneRequest");
        }
Exemplo n.º 5
0
        public static ITuneRequest CreateTuneRequest(ITuningSpace ts)
        {
            int          hr = 0;
            ITuneRequest tr = null;
            Guid         networkType;

            hr = ts.CreateTuneRequest(out tr);
            DsError.ThrowExceptionForHR(hr);

            hr = ts.get__NetworkType(out networkType);

            if (networkType == typeof(ATSCNetworkProvider).GUID)
            {
                // I know nothing about ATSC so thoses lines are pure speculation
                hr = (tr as IATSCChannelTuneRequest).put_Channel(-1);

                IATSCLocator locator = (IATSCLocator) new ATSCLocator();
                hr = locator.put_CarrierFrequency(-1);
                hr = tr.put_Locator(locator as ILocator);
            }
            else if (networkType == typeof(DVBTNetworkProvider).GUID)
            {
                hr = (tr as IDVBTuneRequest).put_ONID(-1);
                hr = (tr as IDVBTuneRequest).put_TSID(-1);
                hr = (tr as IDVBTuneRequest).put_SID(-1);

                IDVBTLocator locator = (IDVBTLocator) new DVBTLocator();
                hr = locator.put_CarrierFrequency(-1);
                hr = tr.put_Locator(locator as ILocator);
            }
            else if (networkType == typeof(DVBSNetworkProvider).GUID)
            {
                hr = (tr as IDVBTuneRequest).put_ONID(-1);
                hr = (tr as IDVBTuneRequest).put_TSID(-1);
                hr = (tr as IDVBTuneRequest).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);
            }

            return(tr);
        }
Exemplo n.º 6
0
        private void TestLocator()
        {
            int      hr = 0;
            ILocator locator;

            hr = tuneRequest.get_Locator(out locator);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(locator != null, "ITuneRequest.get_Locator");

            hr = tuneRequest.put_Locator(locator);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(hr == 0, "ITuneRequest.put_Locator");

            Marshal.ReleaseComObject(locator);
        }
Exemplo n.º 7
0
        private void MakeATuneRequestAndRunTheGraph()
        {
            int      hr = 0;
            ILocator locator;

            // Those values are valid for me but must be modified to be valid depending on your Satellite dish
            hr = tuneRequest.get_Locator(out locator);
            DsError.ThrowExceptionForHR(hr);

            hr = locator.put_CarrierFrequency(11591000);
            DsError.ThrowExceptionForHR(hr);

            hr = (locator as IDVBSLocator).put_SignalPolarisation(Polarisation.LinearV);
            DsError.ThrowExceptionForHR(hr);

            hr = locator.put_SymbolRate(20000);
            DsError.ThrowExceptionForHR(hr);

            hr = tuneRequest.put_Locator(locator);
            DsError.ThrowExceptionForHR(hr);

            Marshal.ReleaseComObject(locator);

            hr = (tuneRequest as IDVBTuneRequest).put_ONID(8442);
            hr = (tuneRequest as IDVBTuneRequest).put_TSID(1);
            hr = (tuneRequest as IDVBTuneRequest).put_SID(260);
            DsError.ThrowExceptionForHR(hr);

            if (tuner.Validate(tuneRequest) == 0)
            {
                hr = tuner.put_TuneRequest(tuneRequest);
                hr = (graphBuilder as IMediaControl).Run();
            }
            else
            {
                Debug.Fail("TuneRequest is not valid");
            }
        }
        private void DoAValidTuneRequest()
        {
            int      hr = 0;
            ILocator locator;

            hr = tuneRequest.get_Locator(out locator);
            DsError.ThrowExceptionForHR(hr);

            // Assume a DVBT hardware
            // A valid carrier frequency must be passed...
            hr = (locator as IDVBTLocator).put_CarrierFrequency(586000);
            hr = tuneRequest.put_Locator(locator);

            // Select the first channel in the first transport stream found...
            hr = (tuneRequest as IDVBTuneRequest).put_ONID(-1);
            hr = (tuneRequest as IDVBTuneRequest).put_TSID(-1);
            hr = (tuneRequest as IDVBTuneRequest).put_SID(-1);

            if (tuner.Validate(tuneRequest) == 0)
            {
                hr = tuner.put_TuneRequest(tuneRequest);
            }
        }
Exemplo n.º 9
0
        public void MakeTuneRequest()
        {
            int      hr = 0;
            ILocator locator;

            // Get a tuning space for this network type
            tuningSpace = BDAUtils.GetTuningSpace(networkType);

            hr = tuner.put_TuningSpace(tuningSpace);
            DsError.ThrowExceptionForHR(hr);

            // Create a tune request from this tuning space
            tuneRequest = BDAUtils.CreateTuneRequest(tuningSpace);

            // Is it okay ?
            hr = tuner.Validate(tuneRequest);
            //DsError.ThrowExceptionForHR(hr);

            if (networkType == BDANetworkType.DVBT)
            {
                // Those values are valid for me but must be modified to be valid depending on your location
                hr = tuneRequest.get_Locator(out locator);
                DsError.ThrowExceptionForHR(hr);

                hr = locator.put_CarrierFrequency(586166);
                DsError.ThrowExceptionForHR(hr);

                hr = tuneRequest.put_Locator(locator);
                DsError.ThrowExceptionForHR(hr);

                Marshal.ReleaseComObject(locator);

                hr = (tuneRequest as IDVBTuneRequest).put_ONID(8442);
                DsError.ThrowExceptionForHR(hr);
                hr = (tuneRequest as IDVBTuneRequest).put_TSID(1);
                DsError.ThrowExceptionForHR(hr);
                hr = (tuneRequest as IDVBTuneRequest).put_SID(259);
                DsError.ThrowExceptionForHR(hr);

/*
 *      hr = locator.put_CarrierFrequency(522166);
 *      DsError.ThrowExceptionForHR(hr);
 *
 *      hr = tuneRequest.put_Locator(locator);
 *      DsError.ThrowExceptionForHR(hr);
 *
 *      Marshal.ReleaseComObject(locator);
 *
 *      hr = (tuneRequest as IDVBTuneRequest).put_ONID(8442);
 *      DsError.ThrowExceptionForHR(hr);
 *      hr = (tuneRequest as IDVBTuneRequest).put_TSID(3);
 *      DsError.ThrowExceptionForHR(hr);
 *      hr = (tuneRequest as IDVBTuneRequest).put_SID(769);
 *      DsError.ThrowExceptionForHR(hr);
 */
/*
 *      hr = locator.put_CarrierFrequency(562166);
 *      DsError.ThrowExceptionForHR(hr);
 *
 *      hr = tuneRequest.put_Locator(locator);
 *      DsError.ThrowExceptionForHR(hr);
 *
 *      Marshal.ReleaseComObject(locator);
 *
 *      hr = (tuneRequest as IDVBTuneRequest).put_ONID(8442);
 *      DsError.ThrowExceptionForHR(hr);
 *      hr = (tuneRequest as IDVBTuneRequest).put_TSID(6);
 *      DsError.ThrowExceptionForHR(hr);
 *      hr = (tuneRequest as IDVBTuneRequest).put_SID(1537);
 *      DsError.ThrowExceptionForHR(hr);
 */
            }

            if (networkType == BDANetworkType.DVBS)
            {
                // Those values are valid for me but must be modified to be valid depending on your Satellite dish

/*
 *      hr = tuneRequest.get_Locator(out locator);
 *      DsError.ThrowExceptionForHR(hr);
 *
 *      hr = locator.put_CarrierFrequency(11591000);
 *      DsError.ThrowExceptionForHR(hr);
 *
 *      hr = (locator as IDVBSLocator).put_SignalPolarisation(Polarisation.LinearV);
 *      DsError.ThrowExceptionForHR(hr);
 *
 *      hr = locator.put_SymbolRate(20000);
 *      DsError.ThrowExceptionForHR(hr);
 *
 *      hr = tuneRequest.put_Locator(locator);
 *      DsError.ThrowExceptionForHR(hr);
 *
 *      Marshal.ReleaseComObject(locator);
 *
 *      hr = (tuneRequest as IDVBTuneRequest).put_ONID(8442);
 *      DsError.ThrowExceptionForHR(hr);
 *      hr = (tuneRequest as IDVBTuneRequest).put_TSID(1);
 *      DsError.ThrowExceptionForHR(hr);
 *      hr = (tuneRequest as IDVBTuneRequest).put_SID(260);
 *      DsError.ThrowExceptionForHR(hr);
 */

                hr = tuneRequest.get_Locator(out locator);
                DsError.ThrowExceptionForHR(hr);

                hr = locator.put_CarrierFrequency(11607000);
                DsError.ThrowExceptionForHR(hr);

                hr = (locator as IDVBSLocator).put_SignalPolarisation(Polarisation.LinearV);
                DsError.ThrowExceptionForHR(hr);

                hr = locator.put_SymbolRate(6944);
                DsError.ThrowExceptionForHR(hr);

                hr = tuneRequest.put_Locator(locator);
                DsError.ThrowExceptionForHR(hr);

                Marshal.ReleaseComObject(locator);

                hr = (tuneRequest as IDVBTuneRequest).put_ONID(144);
                DsError.ThrowExceptionForHR(hr);
                hr = (tuneRequest as IDVBTuneRequest).put_TSID(100);
                DsError.ThrowExceptionForHR(hr);
                hr = (tuneRequest as IDVBTuneRequest).put_SID(289);
                DsError.ThrowExceptionForHR(hr);
            }

            hr = tuner.put_TuneRequest(tuneRequest);
            if (hr < 0)
            {
                Debug.Fail("TuneRequest is not valid");
            }
        }
Exemplo n.º 10
0
        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!");
            }
        }