Esempio n. 1
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");
            }
        }
Esempio n. 2
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");
        }
Esempio n. 3
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);
            }
        }
Esempio n. 5
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");
            }
        }
Esempio n. 6
0
        private void BuildGraph()
        {
            int hr = 0;

            graphBuilder = (IFilterGraph2) new FilterGraph();
            rot          = new DsROTEntry(graphBuilder);

            ICaptureGraphBuilder2 capBuilder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();

            capBuilder.SetFiltergraph(graphBuilder);

            // Get the BDA network provider specific for this given network type
            networkProvider = BDAUtils.GetNetworkProvider(networkType);

            hr = graphBuilder.AddFilter(networkProvider, "BDA Network Provider");
            DsError.ThrowExceptionForHR(hr);

            tuner = (ITuner)networkProvider;

            // 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);
            if (hr == 0)
            {
                // Set it
                hr = tuner.put_TuneRequest(tuneRequest);
                DsError.ThrowExceptionForHR(hr);

                // found a BDA Tuner and a BDA Capture that can connect to this network provider
                BDAUtils.AddBDATunerAndDemodulatorToGraph(graphBuilder, networkProvider, out bdaTuner, out bdaCapture);

                if ((bdaTuner != null) && (bdaCapture != null))
                {
                    // Create and add the mpeg2 demux
                    mpeg2Demux = (IBaseFilter) new MPEG2Demultiplexer();

                    hr = graphBuilder.AddFilter(mpeg2Demux, "MPEG2 Demultiplexer");
                    DsError.ThrowExceptionForHR(hr);

                    // connect it to the BDA Capture
                    hr = capBuilder.RenderStream(null, null, bdaCapture, null, mpeg2Demux);
                    DsError.ThrowExceptionForHR(hr);

                    // Add the two mpeg2 transport stream helper filters
                    BDAUtils.AddTransportStreamFiltersToGraph(graphBuilder, out bdaTIF, out bdaSecTab);

                    if ((bdaTIF != null) && (bdaSecTab != null))
                    {
                        // Render all the output pins of the demux (missing filters are added)
                        for (int i = 0; i < 5; i++)
                        {
                            IPin pin = DsFindPin.ByDirection(mpeg2Demux, PinDirection.Output, i);

                            hr = graphBuilder.Render(pin);
                            Marshal.ReleaseComObject(pin);
                        }
                    }

                    IBDA_Topology topo      = (IBDA_Topology)bdaTuner;
                    int[]         nodeTypes = new int[10];
                    int           nodeTypesCount;

                    // Get all nodes in the BDA Tuner
                    hr = topo.GetNodeTypes(out nodeTypesCount, nodeTypes.Length, nodeTypes);
                    DsError.ThrowExceptionForHR(hr);

                    // For each nodes types
                    for (int i = 0; i < nodeTypesCount; i++)
                    {
                        Guid[] nodeGuid = new Guid[10];
                        int    nodeGuidCount;

                        // Get its exposed interfaces
                        hr = topo.GetNodeInterfaces(nodeTypes[i], out nodeGuidCount, nodeGuid.Length, nodeGuid);
                        DsError.ThrowExceptionForHR(hr);

                        // For each exposed interfaces
                        for (int j = 0; j < nodeGuidCount; j++)
                        {
                            Debug.WriteLine(string.Format("node {0}/{1} : {2}", i, j, nodeGuid[j]));
                            Console.WriteLine(string.Format("node {0}/{1} : {2}", i, j, nodeGuid[j]));

                            // Is IBDA_LNBInfo supported by this node ?
                            if (nodeGuid[j] == typeof(IBDA_LNBInfo).GUID)
                            {
                                // Yes, retrieve this node
                                object ctrlNode;
                                hr = topo.GetControlNode(0, 1, nodeTypes[i], out ctrlNode);
                                DsError.ThrowExceptionForHR(hr);

                                // Do the cast (it should not fail)
                                lnbInfo = ctrlNode as IBDA_LNBInfo;

                                // Exit the for j loop if found a SignalStatistics object
                                if (lnbInfo != null)
                                {
                                    break;
                                }
                            }
                        }

                        // If already found a SignalStatistics object, exit the for i loop
                        if (lnbInfo != null)
                        {
                            break;
                        }
                    }
                }
            }
        }
Esempio n. 7
0
        private void BuildGraph()
        {
            int hr = 0;

            graphBuilder = (IFilterGraph2) new FilterGraph();
            rot          = new DsROTEntry(graphBuilder);

            ICaptureGraphBuilder2 capBuilder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();

            capBuilder.SetFiltergraph(graphBuilder);

            // Get the BDA network provider specific for this given network type
            networkProvider = BDAUtils.GetNetworkProvider(networkType);

            hr = graphBuilder.AddFilter(networkProvider, "BDA Network Provider");
            DsError.ThrowExceptionForHR(hr);

            tuner = (ITuner)networkProvider;

            // 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);
            if (hr == 0)
            {
                // Set it
                hr = tuner.put_TuneRequest(tuneRequest);
                DsError.ThrowExceptionForHR(hr);

                // found a BDA Tuner and a BDA Capture that can connect to this network provider
                BDAUtils.AddBDATunerAndDemodulatorToGraph(graphBuilder, networkProvider, out bdaTuner, out bdaCapture);

                if ((bdaTuner != null) && (bdaCapture != null))
                {
                    // Create and add the mpeg2 demux
                    mpeg2Demux = (IBaseFilter) new MPEG2Demultiplexer();

                    hr = graphBuilder.AddFilter(mpeg2Demux, "MPEG2 Demultiplexer");
                    DsError.ThrowExceptionForHR(hr);

                    // connect it to the BDA Capture
                    hr = capBuilder.RenderStream(null, null, bdaCapture, null, mpeg2Demux);
                    DsError.ThrowExceptionForHR(hr);

                    // Add the two mpeg2 transport stream helper filters
                    BDAUtils.AddTransportStreamFiltersToGraph(graphBuilder, out bdaTIF, out bdaSecTab);

                    if ((bdaTIF != null) && (bdaSecTab != null))
                    {
                        // Render all the output pins of the demux (missing filters are added)
                        for (int i = 0; i < 5; i++)
                        {
                            IPin pin = DsFindPin.ByDirection(mpeg2Demux, PinDirection.Output, i);

                            hr = graphBuilder.Render(pin);
                            Marshal.ReleaseComObject(pin);
                        }
                    }
                }
            }
        }