Microsoft DirectX 8.1 (C++) |
The final step in building a capture graph is to render the streams in the graph. For file capture, the capture pin connects to the file-writing section described in the preceding section. For preview, the preview pin connects to audio and video renderers. However, if the capture filter lacks a preview pin, you must use the capture pin instead. In order to use the same pin for capture and preview, the capture pin must be connected to the Smart Tee filter. This filter splits the data into two streams, a capture stream and a preview stream.
The following diagram shows a graph that uses the Smart Tee filter.
The ICaptureGraphBuilder2::RenderStream method handles all of these tasks, including adding the Smart Tee filter if necessary. In addition, this method automatically adds any supporting filters that are needed for WDM devices. The following code example renders a video stream for file capture:
pBuilder->RenderStream(
&PIN_CATEGORY_CAPTURE, // Pin category
&MEDIATYPE_Video, // Media type
pSrc, // Capture filter
NULL, // Compression filter (optional)
ppf // Multiplexer or renderer filter
);
The first two parameters specify the pin category and media type. The next three parameters are pointers to the following filters:
To render a stream for preview, use PIN_CATEGORY_PREVIEW for the pin category and NULL for the last two parameters. If the capture filter does not have a preview pin, the capture graph builder automatically uses the Smart Tee filter. The following code example renders the video preview stream:
pBuilder->RenderStream(
&PIN_CATEGORY_PREVIEW,
&MEDIATYPE_Video,
pSrc,
NULL, // No compression filter.
NULL // Default renderer.
);
Repeat these calls to RenderStream for each media type that you want to render.
Note Some DV capture filters have one pin for interleaved data (MEDIATYPE_Interleaved) and another for video-only data (MEDIATYPE_Video). Render one of them, not both. If you render the video-only pin, your capture data will not have audio.