Microsoft DirectX 8.1 (C++) |
The term capture can mean writing to a file, but also includes preview or any other use of captured data. Capture is not limited to video camerasfor example, a TV tuner card is a capture device. This topic discusses audio and video capture, but keep in mind that capture data might include closed-captioned or vertical blanking interval (VBI) data.
Capture Graphs
DirectShow handles capture as it does any other task: through filter graphs. This type of graph is called a capture graph. Because of the variety of hardware devices and data formats available, there are many ways to configure a capture graph. Most capture graphs have the following features in common:
Note (Starting with DirectX 8.0 and Windows XP Home Edition and Windows XP Professional, AVStream class supercedes Stream class. See the Windows DDK for more information.)
The following diagram shows the types of filters in a typical capture graph. Dashed lines indicate where additional filters might be required, such as decoder filters or splitter filters.
To simplify the process of building capture graphs, DirectShow provides a component called the Capture Graph Builder. It exposes the ICaptureGraphBuilder2 interface, which has methods for building and controlling capture graphs. This topic assumes you will use the capture graph builder in your capture applications.
Note: The ICaptureGraphBuilder2 interface does not use the Video Mixing Renderer (VMR) or Video Port Manager. To build a capture graph with either or both of these filters, you can still use the ICaptureGraphBuilder2 interface to build the graph, but you will need to remove the Video Renderer manually and replace it with the VMR.
Capture Filters
A capture filter delivers data through one or more output pins. An output pin can be classified by what media type it delivers, and by its pin category.
The media type is represented by a major type GUID. The most common media types are shown in the following table.
Media type | Major type GUID |
Audio | MEDIATYPE_Audio |
Interleaved digital video (DV) | MEDIATYPE_Interleaved |
MPEG Stream | MEDIATYPE_Stream |
Video | MEDIATYPE_Video |
The pin category describes the purpose or function of the pin, and is represented by a property set GUID. There are several pin categories; this topic discusses two of them:
For a list of all the pin categories, see Pin Property Set.
You can query a pin directly for its media type and pin category. To retrieve the media type, call the IPin::EnumMediaTypes method. To retrieve the pin category, call the IKsPropertySet::Get method. Using ICaptureGraphBuilder2 methods, however, you can limit operations to a specific media type or pin category, without querying each pin.