CodeTV.GraphBuilderBDA.AddAndConnectSectionsAndTablesFilterToGraph C# (CSharp) Method

AddAndConnectSectionsAndTablesFilterToGraph() protected method

protected AddAndConnectSectionsAndTablesFilterToGraph ( ) : void
return void
        protected void AddAndConnectSectionsAndTablesFilterToGraph()
        {
            int hr = 0;
            IPin pinOut;
            DsDevice[] devices;

            // Add two filters needed in a BDA graph
            devices = DsDevice.GetDevicesOfCat(FilterCategory.BDATransportInformationRenderersCategory);
            for (int i = 0; i < devices.Length; i++)
            {
                if (devices[i].Name.Equals("MPEG-2 Sections and Tables"))
                {
                    hr = graphBuilder.AddSourceFilterForMoniker(devices[i].Mon, null, devices[i].Name, out this.bdaSecTab);
                    DsError.ThrowExceptionForHR(hr);

                    // Connect the MPEG-2 Demux output pin for the "MPEG-2 Sections and Tables" filter
                    hr = this.mpeg2Demux.FindPin("PSI", out pinOut);
                    if (pinOut != null)
                    {
                        IPin pinIn = DsFindPin.ByDirection(this.bdaSecTab, PinDirection.Input, 0);
                        if (pinIn != null)
                        {
                            hr = this.graphBuilder.Connect(pinOut, pinIn);
                            Marshal.ReleaseComObject(pinIn);
                        }

                        //DsError.ThrowExceptionForHR(hr);
                        // In fact the last pin don't render since i havn't added the BDA MPE Filter...
                        Marshal.ReleaseComObject(pinOut);
                    }

                    continue;
                }
            }
        }