Microsoft DirectX 9.0

Sample Grabber Filter

The Sample Grabber filter provides a way to retrieve samples as they pass through the filter graph. It is a transform filter with one input pin and one output pin. It passes all samples downstream unchanged, so you can insert it into a filter graph without altering the data stream. Your application can then retrieve individual samples from the filter by calling methods on the ISampleGrabber interface.

If you want to retrieve samples without rendering the data, connect the Sample Grabber filter to the Null Renderer filter.

Filter interfaces IBaseFilter, ISampleGrabber
Input pin media types Any media type.
Input pin interfaces IMemInputPin, IPin, IQualityControl
Output pin media types Any media type. Matches input media type.
Output pin interfaces IMediaPosition, IMediaSeeking, IPin, IQualityControl
Filter CLSID CLSID_SampleGrabber
Property Page CLSID No property page.
Executable Qedit.dll
Filter Category CLSID_LegacyAmFilterCategory


To use this filter, add it to the filter graph and call ISampleGrabber::SetMediaType with the desired media type. This method specifies the media type for the filter's input and output pin connections. Then connect the filter to other filters in the graph.

If you call ISampleGrabber::SetBufferSamples with the value TRUE, the filter buffers each sample that it receives before passing it downstream. Call the ISampleGrabber::GetCurrentBuffer method to retrieve the current contents of the buffer. Alternatively, you can call ISampleGrabber::SetCallback to have the filter invoke a callback function whenever it receives a sample.

The filter does not support video types with top-down orientation (negative biHeight) or with format type FORMAT_VideoInfo2. Also, it rejects any video type where the surface stride does not match the video width. This means that for some video types, the Sample Grabber will not connect to the Video Mixing Renderer (VMR).

See Also