private void ConfigurePusher(IGenericSampleConfig2 ips, ImageHandler ih) { int hr; ih.SetMediaType(ips); // Specify the callback routine to call with each sample hr = ips.SetBitmapCB(ih); DsError.ThrowExceptionForHR(hr); }
private void AddGSSF(ImageHandler ih, ICaptureGraphBuilder2 icgb2, out IPin pPin) { int hr; // Our data source. An error here means the GSSF2 sample hasn't // been registered. IBaseFilter ipsb = (IBaseFilter)new GenericSampleSourceFilter2(); try { // Get the pin from the filter so we can configure it pPin = DsFindPin.ByDirection(ipsb, PinDirection.Output, 0); // Configure the pin using the provided BitmapInfo ConfigurePusher((IGenericSampleConfig2)pPin, ih); // Add the filter to the graph hr = m_pGraph.AddFilter(ipsb, "GenericSampleSourceFilter"); Marshal.ThrowExceptionForHR(hr); // Connect the filters together, use the default renderer hr = icgb2.RenderStream(null, null, pPin, null, m_pEVR); DsError.ThrowExceptionForHR(hr); } finally { Marshal.ReleaseComObject(ipsb); } }