Partager via


Video Previews (Windows Embedded CE 6.0)

1/6/2010

To build a video preview graph, call the ICaptureGraphBuilder2::RenderStream method as follows:

ICaptureGraphBuilder2 *pBuild; // Capture Graph Builder
// Initialization of pBuild (not shown).

IBaseFilter *pCap; // Video capture filter.
// Initialize pCap and add it to the filter graph (not shown).

hr = pBuild->RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, 
    pCap, NULL, NULL);

This example assumes the following:

The first parameter to the ICaptureGraphBuilder2::RenderStream method specifies a pin category; for a preview graph, use PIN_CATEGORY_PREVIEW (see Pin Property Set). The second parameter specifies a media type, as a major type GUID. For video, use MEDIATYPE_Video (see Media Types and Sub Types). DV devices deliver interleaved audio and video, for which the media type is MEDIATYPE_Interleaved.

The third parameter is a pointer to the capture filter's IBaseFilter Interface interface. The next two parameters are not needed in this example. They are used to specify additional filters that might be needed to render the stream. Setting the last parameter to NULL causes the Capture Graph Builder to select a default renderer for the stream, based on the media type. For video, the Capture Graph Builder always uses the DirectShow Video Renderer Filter as the default renderer.

Although the pin category is given as PIN_CATEGORY_PREVIEW, it does not matter whether the filter actually has a preview pin; it could just have a capture pin. In either case, the Capture Graph Builder automatically builds the correct graph.

The following diagram shows the simplest possible graph for previewing video.

Ee495574.5320faeb-2b6c-4332-ae2e-09e7b1b3c1e6(en-US,WinEmbedded.60).gif

In this diagram, the capture filter has a preview pin, which connects directly to the video renderer.

If the capture filter has only a capture pin, the Capture Graph Builder inserts a Smart Tee Filter, which splits the stream into a capture stream and a preview stream. This is described in more detail in Combining Video Capture and Preview.

In some cases, the video stream must go through the Overlay Mixer filter. If so, the ICaptureGraphBuilder2::RenderStream** method adds it to the graph automatically. **

See Also

Concepts

Video Capture