Video Previews (Windows CE 5.0)

Send Feedback

Applies to: Devices based on Windows Mobile Version 5.0 and later

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). 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. 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.

ms940080.dshow_video_preview(en-us,MSDN.10).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

Video Capture

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.