// disconnect all connected audio out pins and remove unused filters private void StripSplitter(IGraphBuilder pGraphBuilder) { if (_splitterFilter != null) { IPin pPin = null; int nSkip = 0; while ((pPin = DsUtils.GetPin(_splitterFilter, PinDirection.Output, true, nSkip)) != null) { if (DsUtils.IsMediaTypeSupported(pPin, MediaType.Audio) == 0 || DsUtils.IsMediaTypeSupported(pPin, MediaType.Subtitle) == 0) { // this connected pin supports audio or subpicture type! DsUtils.Disconnect(pGraphBuilder, pPin); } else { nSkip++; } Marshal.ReleaseComObject(pPin); } // end of while DsUtils.RemoveRedundantFilters(_sourceFilter, pGraphBuilder); } }
public IPin GetInputPin() { IPin pPin = null; if (BaseFilter != null) { // try unconnected pins first pPin = DsUtils.GetPin(BaseFilter, PinDirection.Input); if (pPin == null) { // let's try connected pins if ((pPin = DsUtils.GetPin(BaseFilter, PinDirection.Input, true)) != null) { DsUtils.Disconnect(GraphBuilder, pPin); } } } return(pPin); }
private bool GetPins(out IPin rendererInputPin, out IPin decoderOutPin) { bool bRet = false; rendererInputPin = decoderOutPin = null; if (BaseFilter != null && (rendererInputPin = DsUtils.GetPin(BaseFilter, PinDirection.Input, true)) != null) { int hr = rendererInputPin.ConnectedTo(out decoderOutPin); if (hr == DsHlp.S_OK) { DsUtils.Disconnect(GraphBuilder, rendererInputPin); bRet = true; } else { Marshal.ReleaseComObject(rendererInputPin); rendererInputPin = null; } } return(bRet); }