Microsoft DirectX 8.1 (C++)

Using the Sample Grabber

The Sample Grabber Filter is a transform-inplace filter that applications can use to grab media samples from a stream as they pass through the filter.

If you simply want to grab a poster frame from a video file, it is easier to use the Media Detector (MediaDet) object. See Grabbing a Poster Frame for details. The Sample Grabber is more flexible, however, because it works with nearly any media type (see ISampleGrabber::SetMediaType for the few exceptions), and offers more control to the application.

To use the Sample Grabber:

  1. Specify the media type that you want to capture.
  2. Build a filter graph that contains the Sample Grabber.
  3. Run the filter graph.
  4. Get buffered samples from the Sample Grabber, or implement a callback function that is called whenever the Sample Grabber receives a new sample.

This article contains the following sections: