Microsoft DirectX 8.1 (C++) |
To capture a type-2 file while previewing, use the filter graph shown in the following diagram.
This graph is almost the same as the graph for type-1 capture. Instead of sending the interleaved stream directly to the AVI Mux filter, however, the graph routes it through the DV Splitter filter. The AVI Mux therefore receives two streams, an audio stream and a DV-encoded video stream.
To build this graph, use the following code:
// Create the DV Splitter and add it to the filter graph.
IBaseFilter *pDVSplit;
hr = CoCreateInstance(CLSID_DVSplitter, 0, CLSCTX_INPROC_SERVER,
IID_IBaseFilter, reinterpret_cast<void**>)(&pDVSplit));
hr = pGraph->AddFilter(pDVSplit, L"DV Splitter");
hr = pBuilder->SetOutputFileName(&MEDIASUBTYPE_Avi,
OLESTR("C:\\Example2.avi"), &pAviMux, 0);
hr = pBuilder->RenderStream(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Interleaved,
pDV, pDVSplit, pAviMux);
hr = pBuilder->RenderStream(0, 0, pDVSplit, 0, pAviMux);
hr = pBuilder->RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Interleaved,
pDV, 0, 0);
Create the DV Splitter and add it to the filter graph. The first call to RenderStream routes the interleaved stream to the DV Splitter, and routes one stream from the DV Splitter to the AVI Mux filter. The second call to RenderStream routes the other stream from the DV Splitter to the AVI Mux. The last call to RenderStream renders the preview stream, as in the previous example.