Example #1
0
        /// <summary>
        /// </summary>
        /// <param name="pGraph"></param>
        /// <param name="pSrc"></param>
        /// <param name="pDest"></param>
        /// <returns></returns>
        public static bool ConnectFilters(this IGraphBuilder pGraph, IBaseFilter pSrc, IBaseFilter pDest)
        {
            // Find an output pin on the first filter.
            IPin pIn = pDest.FindUnconnectedPin(PinDirection.Input);
            IPin pOut = pSrc.FindUnconnectedPin(PinDirection.Output);

            if (pIn == null || pOut == null) return false;

            int hresult = pGraph.Connect(pOut, pIn);
            Marshal.ThrowExceptionForHR(hresult);

            pIn.Dispose();
            pOut.Dispose();
            return true;
        }